示例#1
0
    public void RunFrame()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            ChangeGameMode(0);
            return;
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            ChangeGameMode(1);
            return;
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            Restart();
            return;
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            paused = !paused;
        }

        if (paused)
        {
            return;
        }

        Command command = GetCommandFromInput();

        //lastCommand = command != Command.None ? command : lastCommand;
        gameMode.ProcessUserCmd(command);
        frameTimer -= Time.deltaTime;
        if (frameTimer < 0)
        {
            frameTimer = frameInterval;
            //gameMode.ProcessUserCmd(lastCommand);
            //lastCommand = Command.None;
            gameMode.Tick();
        }
    }