Exemple #1
0
 /// <summary>
 /// Inflict damages to all attackable that enter in the trap
 /// </summary>
 protected virtual void InflinctDamage(Component[] attackables)
 {
     foreach (IAttackable a in attackables)
     {
         a.OnAttack(gameObject, _attack.CreateAttack());;
     }
 }
    public void AttackTarget(GameObject target)
    {
        var attack      = demoAttack.CreateAttack(stats, target.GetComponent <CharacterStats>());
        var attackables = target.GetComponentsInChildren(typeof(IAttackable));

        foreach (IAttackable attackable in attackables)
        {
            attackable.OnAttack(gameObject, attack);
        }
    }
        /// <summary>
        /// Attack with dive kick
        /// </summary>
        /// <param name="defender">Character beeing attacked</param>
        public void DiveKickAttack(GameObject defender)
        {
            Attack attack      = _divekickAttack.CreateAttack(_stats);
            var    attackables = defender.GetComponentsInChildren(typeof(IAttackable));

            foreach (IAttackable a in attackables)
            {
                a.OnAttack(gameObject, attack);
            }

            EndAttack();
        }
    // MouseManager => UnityEvents
    public void AttackTarget(GameObject target)
    {
        IAttackable attackable = target.GetComponent <IAttackable>();

        if (attackable == null)
        {
            return;
        }
        attackable.OnAttack(gameObject);

        var attack = demoAttack.CreateAttack(gameObject, target);

        demoAttack.ExecuteAttackEffecs(gameObject, target, attack);
    }