public void TargetCharacter(Character character)
    {
        characterPortrait.sprite = character.traitsSprite;
        Character.Hunger    hunger    = character.GetHunger();
        Character.Hydration hydration = character.GetHydration();
        Character.Injury    injury    = character.GetInjury();
        Character.Sickness  sickness  = character.GetSickness();

        hungerImage.sprite   = statusManager.hungerStateSprites[( int )hunger];
        thirstImage.sprite   = statusManager.hydratedStateSprites[( int )hydration];
        injuryImage.sprite   = statusManager.injuryStateSprites[( int )injury];
        sicknessImage.sprite = statusManager.sicknessStateSprites[( int )sickness];
    }
Пример #2
0
    void Update()
    {
        if (gameStateManager.GetState() == GameState.State.DAY)
        {
            Character          character = characterManager.GetCharacter();
            Character.Sickness sickness  = character.GetSickness();

            Timestamp timeWhenDeadToHunger = character.GetTimeWhenDeadToHunger();

            Timestamp currentTime = timeManager.GetTime();
            uint      hoursUntilDeadFromHunger = timeManager.HoursBetweenTimestamps(currentTime, timeWhenDeadToHunger);

            if (hoursUntilDeadFromHunger < hoursBelowForVerySick && sickness < Character.Sickness.VERY_SICK)
            {
                character.SetSickness(Character.Sickness.VERY_SICK);

                float random = Random.Range(0.0f, 100.0f);

                if (chanceToDieAtVerySick > random)
                {
                    character.Kill();
                }
            }
            else if (hoursUntilDeadFromHunger < hoursBelowForSick && sickness < Character.Sickness.SICK)
            {
                character.SetSickness(Character.Sickness.SICK);

                float random = Random.Range(0.0f, 100.0f);

                if (chanceToDieAtSick > random)
                {
                    character.Kill();
                }
            }
            else if (hoursUntilDeadFromHunger < hoursBelowForSlightlySick && sickness < Character.Sickness.SLIGHTLY_SICK)
            {
                character.SetSickness(Character.Sickness.SLIGHTLY_SICK);

                float random = Random.Range(0.0f, 100.0f);

                if (chanceToDieAtSlightlySick > random)
                {
                    character.Kill();
                }
            }
        }
    }