コード例 #1
0
 public bool TryDoAction()
 {
     if (ActionValidate() && apController.TrySpendAP(this))
     {
         gridController.GridPosition = target.Value;
         target = null;
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
    public bool TryDoAction()
    {
        if (ActionValidate() && apController.TrySpendAP(this))
        {
            float hit = Random.Range(0f, 1f);
            if (hit < Attack.HitChange)
            {
                Target.Subtract(Attack.Damage);

                BroadcastMessage("OnAttackSuccess", new AttackMessage(Attack, Target));
                Target.gameObject.BroadcastMessage("OnAttackHit", new AttackMessage(Attack, this));
            }

            Target = null;
            Attack = null;

            return(false);
        }
        else
        {
            return(false);
        }
    }