예제 #1
0
    void ApplyDamageTo(GameObject otherGameObject)
    {
        var otherUnit = otherGameObject.GetComponent <GameUnit>();

        if (otherUnit != null)
        {
            if (CanDamageUnit(otherUnit))
            {
                bool wasDead = otherUnit.IsDead();

                otherUnit.ApplyDamage(damage);

                bool isDead = otherUnit.IsDead();
                if (wasDead == false && isDead == true && ownerUnit != null)
                {
                    ownerUnit.DidKill(otherUnit);
                }
            }
        }
    }