コード例 #1
0
    private void OnChangeHunger(CharacterHungerState oldHunger, CharacterHungerState newHunger)
    {
        switch (newHunger)
        {
        case CharacterHungerState.FULL:
            bellyRenderer.sprite = fullBelly;
            break;

        case CharacterHungerState.NORMAL:
            bellyRenderer.sprite = normalBelly;
            break;

        case CharacterHungerState.STARVING:
            bellyRenderer.sprite = hungryBelly;
            break;

        default:
            Debug.LogError($"{newHunger} hunger state not handled");
            break;
        }
    }
コード例 #2
0
 internal void FireChangeHungerStateEvent(CharacterHungerState currentHungerState, CharacterHungerState newHungerState)
 {
     ChangeHungerStateEvent?.Invoke(currentHungerState, newHungerState);
 }