private bool CheckPlayerKeyboard(EControllerType keyboardType) { foreach (var player in players) { if (player.ControllerType == keyboardType) { return(true); } } return(false); }
public PlayerInput(InputDevice device, int index, PlayerType role, EControllerType controllerType) { Device = device; Index = index; Role = role; ControllerType = controllerType; //to refactor if (controllerType == EControllerType.Keyboard1) { KeyboardType = "Space"; InputAxeX = "Horizontal3"; InputAxeY = "Vertical3"; Left = KeyCode.A; Right = KeyCode.D; Action1 = KeyCode.Space; Action2 = KeyCode.LeftControl; Action3 = KeyCode.R; Action4 = KeyCode.E; } else if (controllerType == EControllerType.Keyboard2) { KeyboardType = "Enter"; InputAxeX = "Horizontal2"; InputAxeY = "Vertical2"; Left = KeyCode.LeftArrow; Right = KeyCode.RightArrow; Action1 = KeyCode.KeypadEnter; Action2 = KeyCode.Keypad0; Action3 = KeyCode.KeypadPlus; Action4 = KeyCode.KeypadMinus; } else { KeyboardType = null; } }
public Controller(EControllerType type) { this.controllerType = type; }