示例#1
0
    public void Death(Experience otherUnit)
    {
        //pre death stuff

        GetComponent <Unit>().GM.ThisGame[GetComponent <Unit>().Owner].Units.Remove(gameObject);

        GetComponent <Pathfinding>().CurrentLocation.GetComponent <Pathnode>().CurrentOccupant = null;

        if (GetComponent <Unit>().AIOverlord != null && GetComponent <Unit>().Owner == GetComponent <Unit>().GM.CurrentTurn)
        {
            GetComponent <Unit>().AIOverlord.GetComponent <Tracker>().NextUnit();
        }
        if (otherUnit.GetComponent <Unit>().AIOverlord != null && otherUnit.GetComponent <Unit>().Owner == otherUnit.GetComponent <Unit>().GM.CurrentTurn)
        {
            otherUnit.GetComponent <Unit>().AIOverlord.GetComponent <Tracker>().NextUnit();
        }

        var experience = GetComponent <Experience>().GetExpBonus();

        if (otherUnit != null)
        {
            otherUnit.RewardExp(experience);
        }

        GetComponent <Unit>().GM.UnitDeath(GetComponent <Unit>());

        Destroy(gameObject);
    }