Пример #1
0
    // Do we have a target to attack?
    private static bool CanAttackAnything(CreatureStats permanent)
    {
        // Check if there is a target in front of us
        CreatureStats target = permanent.GetAttackTarget();

        if (target && target.OwnedBy != permanent.OwnedBy)
        {
            return(true);
        }
        return(false);
    }
Пример #2
0
    private static void Attack(CreatureStats permanent)
    {
        CreatureStats enemy  = permanent.GetAttackTarget();
        Damage        damage = new Damage(permanent.Attack, DamageType.Physical);

        enemy.TakeDamage(new Source(creature: permanent), damage);

        permanent.GetComponent <Animator>().Play("Attack");
        StateManager.RegisterAnimation(AnimationAttackDuration);

        EventManager.InvokeCreatureAttack(permanent, enemy, damage);
        EventManager.InvokeCreatureAttacked(enemy, permanent);
    }