Пример #1
0
    void PushState()
    {
        ChestTimeState cts = new ChestTimeState();

        cts.isOpen                  = isOpen;
        cts.finishedOpening         = finishedOpening;
        cts.openingTimerSecondsLeft = finishedOpeningTimer.SecondsLeft;

        states.Add(cts);
    }
Пример #2
0
    void PopState()
    {
        int lastIndex = states.Count - 1;

        if (lastIndex > -1)
        {
            ChestTimeState lastState = states[lastIndex];
            states.RemoveAt(lastIndex);

            if (!lastState.isOpen && isOpen)
            {
                Close();
            }

            if (lastState.finishedOpening)
            {
                reverseAudioManager.
                CreateReverseAudioSource(AudioClipName.ChestOpen);
            }
            finishedOpening = lastState.finishedOpening;

            finishedOpeningTimer.Duration = lastState.openingTimerSecondsLeft;
        }
    }