/// <summary>
    /// Raises a combat event for when an enemy is detected
    /// </summary>
    /// <param name="enemy">Enemy.</param>
    protected virtual void OnEnemyDetected(BaseFighter enemy)
    {
        CombatEventHandler hand = CombatEvent;

        if (hand != null)
        {
            hand(this, new CombatEventArgs(enemy));
        }
    }
Exemple #2
0
    /// <summary>
    /// Message occurs when this unit has died
    /// </summary>
    public void OnDeath()
    {
        // Fire ourn DeathEvent
        CombatEventHandler hand = DeathEvent;

        if (hand != null)
        {
            hand(this, new CombatEventArgs(null, CombatEventArgs.CombatMsg.IsDefeated));
        }

        // Flag ourselves as not being able to walk
        canWalk = false;
    }
    /// <summary>
    /// Raises a combat event for when this unit is defeated
    /// </summary>
    protected virtual void OnDeath()
    {
        CombatEventHandler hand = CombatEvent;

        if (hand != null)
        {
            // Fire the event using the special Death version
            hand(this, new CombatEventArgs(null, CombatEventArgs.CombatMsg.IsDefeated));
        }

        // Finally, flag this GameObject for deletion
        Destroy(this.gameObject);
    }