示例#1
0
    /*
     * Take amount damage from a source. Only servers can take damage
     */
    public void TakeDamage(int amount, int damageType)
    {
        if (!isServer)
        {
            return;
        }

        hp -= amount - (damageType == 0 ? PHYSICALRESIST : MAGICRESIST);
        if (hp <= 0)
        {
            // give other team gold
            enemySpawn.CmdGainCannonGold();
            Destroy(this.gameObject);
        }
    }