예제 #1
0
    protected override void Update()
    {
        base.Update();
        switch (State)
        {
        case MoveState.Paused:
            Idle();
            break;

        case MoveState.Recording:
            if (started)
            {
                Seconds += Time.deltaTime;
            }
            else
            {
                Idle();
            }

            if (Seconds >= 10)
            {
                Seconds = 10;
                return;
            }

            var key = new Key(this.Seconds);
            if (Input.GetKeyUp(Settings.Keymap.Walk))
            {
                key.Action = Idle;
            }
            else if (Input.GetKeyDown(Settings.Keymap.Walk))
            {
                key.Action = Walk;
            }

            if (key.Action != null)
            {
                if (key.Action != Idle)
                {
                    started = true;
                }

                key.Action();
                Moves.Enqueue(key);
            }
            break;

        case MoveState.Playing:
            if (!started)
            {
                Tfm.position = InitialPosition;
                Ability      = true;
                started      = true;
            }
            if (Moves.Count > 0 && Game.Seconds >= Moves.Peek().Time)
            {
                Moves.Dequeue().Action();
            }
            break;

        default:
            throw new NotImplementedException(string.Format("State {0} not implemented", State));
        }
    }