示例#1
0
    private IEnumerator Action()
    {
        while (onAnimation)
        {
            yield break;
        }

        if (!BSM.TurnOrder[0].TurnEnd)
        {
            onAnimation = true;


            if (BSM.TurnOrder[0].IsAoE || BSM.TurnOrder[0].TargetAlly)
            {
                Target = this.transform;
            }
            else
            {
                Target = BSM.TurnOrder[0].Target.transform;
            }

            //Animation
            if (BSM.TurnOrder[0].ChosenAttack != null)
            {
                BSM.ActiveSkillDisplayMenu();
            }

            Vector3 offset = Target.forward * 1.8f;
            endPos = Target.position + offset;
            while (MoveTowardTarget(endPos)) //move toward attack target
            {
                yield return(null);
            }

            yield return(new WaitForSeconds(0.35f));//Damage Calculation

            BSM.DamageCalculation();
            BSM.ApplyAdditionEffects();
            BSM.DisactiveSkillDisplayMenu();

            while (MoveTowardTarget(startPos)) //return to your startPosition
            {
                yield return(null);
            }

            //animation is finished
            BSM.TurnOrder[0].SetTurnEnd();
            BSM.OnTurnEnd();

            onAnimation = false;
        }
    }