Beispiel #1
0
    /// <summary>
    /// record the state of the gameObject
    /// </summary>
    void PushState()
    {
        EnemySpawnerTimeState ests = new EnemySpawnerTimeState();

        ests.timerSecondsLeft = spawnTimer.SecondsLeft;
        ests.spawnCounter     = spawnCounter;

        states.Add(ests);
    }
Beispiel #2
0
    /// <summary>
    /// Rewind the state by 1 stored frame
    /// </summary>
    void PopState()
    {
        int lastIndex = states.Count - 1;

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

            spawnTimer.Duration = lastState.timerSecondsLeft;
            spawnCounter        = lastState.spawnCounter;
        }
    }