public override Command GetCommand() { Command c; c.GameTick = 0; //TODO: set correct game tick c.PlayerId = this.PlayerId; c.PlayerCommand = CommandType.Idle; KeyboardInputSource kis = KeyboardInputSource.GetKeyboardInputSource(); if (kis.HasKeyBeenPressed(keyUp)) { //Console.WriteLine("UP"); c.PlayerCommand = CommandType.GoUp; } if (kis.HasKeyBeenPressed(keyRight)) { //Console.WriteLine("RIGHT"); c.PlayerCommand = CommandType.GoRight; } if (kis.HasKeyBeenPressed(keyDown)) { //Console.WriteLine("DOWN"); c.PlayerCommand = CommandType.GoDown; } if (kis.HasKeyBeenPressed(keyLeft)) { //Console.WriteLine("LEFT"); c.PlayerCommand = CommandType.GoLeft; } return(c); }
static public KeyboardInputSource GetKeyboardInputSource() { if (keyboardInputSourceInstance == null) { keyboardInputSourceInstance = new KeyboardInputSource(); } return(keyboardInputSourceInstance); }