Example #1
0
    public virtual void Update()
    {
        switch (state)
        {
        case ActionState.non:
            break;

        case ActionState.move:
            Move();
            break;

        case ActionState.atkbegin:

            if (target == null || target.IsDie())
            {
                parent.StopAction();
                return;
            }
            atkTime += Time.deltaTime;
            if (atkTime > (1 / parent.GetAtkSpeed()) * 0.5f)
            {
                Atk();
            }
            break;

        case ActionState.atkend:

            if (target == null || target.IsDie())
            {
                parent.StopAction();
                return;
            }

            atkTime += Time.deltaTime;
            if (atkTime >= (1 / parent.GetAtkSpeed()))
            {
                parent.SetAnimatorState(InGameBaseCharacter.AnimatorState.Idle, 1);
                if (atkTime >= (1 / parent.GetAtkSpeed()) * 1.1)
                {
                    StartAtk();
                }
            }
            break;
        }
    }