예제 #1
0
    public virtual void ProcessAging()
    {
        // 75% chance per month to check to die.
        if (Random.value <= Constants.LIFE_CHANCE_TO_CHECK_IF_MONTH_COULD_KILL_YOU / 100f)
        {
            float chanceToDie = Zeus.CalculateBaseChanceToRandomlyDie(Age);
            float ran         = Random.value;

            deathChanceModifier.ForEach(x => chanceToDie += ((x / 100f) / 100f));

            if (ran < chanceToDie)
            {
                Die();
            }

            if (this.FirstName == "Player")
            {
                // Debug.Log (string.Format ("{0} (At Age: {3}/{4}: {1}% ({2}). Killed you? {5}", this.FirstName, (chanceToDie * 100f).ToString("N7"), ran, Age, Age / 12, (ran < chanceToDie)));
            }
        }

        if (Age == Constants.LIFE_ABSOLUTE_MAX_AGE_IN_MONTHS)
        {
            Die();
        }

        if (!IsDead)
        {
            Age++;
            ProcessDiseases((Age == 0));
        }
    }