Ejemplo n.º 1
0
 public void AttackUnitForDamage(AbstractBattleUnit targetUnit, AbstractBattleUnit sourceUnit, int baseDamageDealt, AbstractCard cardPlayed)
 {
     Require.NotNull(targetUnit);
     QueuedActions.DelayedActionWithCustomTrigger("AttackUnitForDamage_ShakeUnit", () => {
         if (targetUnit.IsDead || sourceUnit.IsDead)
         {
             // do nothing if it's already dead
             IsCurrentActionFinished = true;
             return;
         }
         targetUnit.CorrespondingPrefab.gameObject.AddComponent <ShakePrefab>();
         var shakePrefab = targetUnit.CorrespondingPrefab.gameObject.GetComponent <ShakePrefab>();
         shakePrefab.Begin(() => { IsCurrentActionFinished = true; });
         targetUnit.CorrespondingPrefab.FlickerFeedbacks.PlayFeedbacks();
         BattleRules.ProcessDamageWithCalculatedModifiers(sourceUnit, targetUnit, cardPlayed, baseDamageDealt);
     });
 }
Ejemplo n.º 2
0
    public void DamageUnitNonAttack(AbstractBattleUnit targetUnit, AbstractBattleUnit nullableSourceUnit, int baseDamageDealt)
    {
        if (targetUnit == null)
        {
            return;
        }
        QueuedActions.DelayedActionWithCustomTrigger("DamageUnitNonAttack_ShakeUnit", () => {
            if (targetUnit.IsDead)
            {
                // do nothing if it's already dead
                IsCurrentActionFinished = true;
                return;
            }
            targetUnit.CorrespondingPrefab.gameObject.AddComponent <ShakePrefab>();
            var shakePrefab = targetUnit.CorrespondingPrefab.gameObject.GetComponent <ShakePrefab>();
            shakePrefab.Begin(() => { IsCurrentActionFinished = true; });
            targetUnit.CorrespondingPrefab.FlickerFeedbacks.PlayFeedbacks();

            BattleRules.ProcessDamageWithCalculatedModifiers(nullableSourceUnit, targetUnit,
                                                             nullableCardPlayed: null,
                                                             baseDamage: baseDamageDealt,
                                                             isAttack: false);
        });
    }