Example #1
0
    public override IEnumerator OnEnterPreBattle()
    {
        if (Target != null)
        {
            if (!PlayerUnitUtils.CheckIfEnemyIsInBattleWithOtherUnit(Target))
            {
                yield return(StartCoroutine(PlayerUnitUtils.TellEnemyToPrepareFor1on1battleWithMe(Target, this)));

                animationController.OnWalking();
                yield return(StartCoroutine(PlayerUnitUtils.MoveToTargetAndInvokeAction(this, PlayerUnitUtils.FindDirectBattlePosition(SR, Target.SR),
                                                                                        dataLegacy.speed, (Target == null), Target.OnBattleInitiate)));

                SM.SetState(States.InDirectBattle);
            }
            else
            {
                animationController.OnWalking();
                yield return(StartCoroutine(PlayerUnitUtils.MoveToTargetAndInvokeAction(this, PlayerUnitUtils.FindJoinBattlePosition(SR, Target.SR),
                                                                                        dataLegacy.speed, (Target == null), null)));

                SM.SetState(States.JoinBattle);
            }

            yield break;
        }
        else
        {
            SM.SetState(States.Default);
        }
    }
Example #2
0
    public override IEnumerator OnEnterDefault()
    {
        dataLegacy.EnemyTarget      = null;
        dataLegacy.EffectableTarget = null;
        animationController.OnWalking();
        yield return(StartCoroutine(PlayerUnitUtils.ReturnToBattlePosition(this)));

        animationController.OnIdle();
        yield break;
    }
Example #3
0
 public override IEnumerator OnEnterJoinBattle()
 {
     if (Target != null)
     {
         if (Target.transform.position.x > transform.position.x)
         {
             SetXdirection(false);
         }
         if (Target.transform.position.x < transform.position.x)
         {
             SetXdirection(true);
         }
         animationController.OnIdle();
         yield return(StartCoroutine(PlayerUnitUtils.AttackCoroutineAndInvokeAction(this, !PlayerUnitUtils.StandardConditionToAttack(this), dataLegacy.AttackRate, OnAttack)));
     }
     SM.SetState(States.PostBattle);
     yield break;
 }
Example #4
0
 public override bool IsTargetable()
 {
     return(PlayerUnitUtils.StandardIsTargetable(this));
 }
Example #5
0
    public override IEnumerator OnEnterPostBattle()
    {
        yield return(StartCoroutine(PlayerUnitUtils.StandardPostBattleCheck(this)));

        yield break;
    }