Exemple #1
0
    public void Kill(string cause = "nothing")
    {
        isAlive = false;
        var reason = "";

        if (cause == "wolves")
        {
            reason = "been killed by wolves";
        }
        else if (cause == "bandits")
        {
            reason = "been killed by bandits";
        }
        else if (warmth <= 0)
        {
            reason = "frozen to death";
        }
        else if (hunger <= 0)
        {
            reason = "died of hunger";
        }
        else if (illness != null)
        {
            reason = string.Format("died of {0}", illness.diseaseName);
        }
        else
        {
            reason = "died";
        }
        var msg1 = string.Format("{0} has {1}", characterName, reason);
        var msg2 = "Rest in peace";

        gc.InstantiatePopup(msg1, msg2);
        caravan.AddNewAvailablePosition(transform.position);
        caravan.RemoveCaravanMember(this);
        Destroy(gameObject);
    }