public void Execute(string action) { if (action.Equals("QT")) { remote.Disconnect(); } else if (action.Equals("RS")) { api.ResetGame(Config.width, Config.height, Config.virusHeight, Config.virusCount); } else if (action[0] == 'M') { switch (action[1]) { case 'L': game.MoveLeft(); break; case 'R': game.MoveRight(); break; case 'D': game.MoveDown(); break; } } else if (action[0] == 'R') { switch (action[1]) { case 'L': api.RotateLeft(); break; case 'R': api.RotateRight(); break; } } else if (action.Equals("WT")) { if (Config.stepMode) { do { api.Wait(); } while (!game.PlayerCanPlay() && !game.GameHasEnded()); } else { api.Wait(); } } }
void Update() { if (Input.GetKey(quit)) { Application.Quit(); } if (Input.GetKey(disconnect)) { remote.Disconnect(); } if (Input.GetKeyDown(connect)) { remote.Listen(); } }