1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using BehaviorDesigner.Runtime;
- using BehaviorDesigner.Runtime.Tasks;
- using UnityEngine.SceneManagement;
- using UnityGameFramework.Runtime;
- /// <summary>
- /// 行为 受击
- /// </summary>
- public class ActionBehit : Action
- {
- [BehaviorDesigner.Runtime.Tasks.Tooltip("等待时间")]
- public SharedFloat waitTime = 1;
- /// <summary>
- /// 开始时间
- /// </summary>
- private float startTime;
- /// <summary>
- /// 动画控制器
- /// </summary>
- private Animator animator = null;
- public override void OnAwake()
- {
- animator = gameObject.GetComponentInChildren<Animator>();
- }
- public override void OnStart()
- {
- startTime = Time.time;
- animator.SetBool("Hit", true);
- }
- public override TaskStatus OnUpdate()
- {
- if (startTime + waitTime.Value < Time.time)
- {
- return TaskStatus.Success;
- }
- return TaskStatus.Running;
- }
- }
|