/// <summary> /// This binds a key to a command with a point of origin /// </summary> /// <param name="keyCode"></param> /// <param name="command"></param> /// <param name="origin"></param> public void BindInputToCommandWithOrigin(KeyCode keyCode, IGameObjectCommand command, GameObject origin) { _keyOriginCommands.Add(new KeyOriginCommand() { _key = keyCode, _command = command, _origin = origin }); }
public void Setup() { InputHandlerScalable inputHandlerScalable = new InputHandlerScalable(); var fireCommand = new FireGunCommand(); inputHandlerScalable.BindInputToCommand(KeyCode.X, fireCommand); //Alternative Fire Button inputHandlerScalable.BindInputToCommand(KeyCode.R, fireCommand); InputHandler inputHandler = new InputHandler(new JumpCommand(), new WeaponSwitchCommand()); IGameObjectCommand command = inputHandler.HandleInput(); command.Execute(gameObject); }
public void Setup() { //1110 NORTH WEST //1000 EAST //& //1000 bool containsEast = (windDirection & WindDirection.East) != 0; switch (windDirection) { case WindDirection.East: break; case WindDirection.North: break; } InputHandlerScalable inputHandlerScalable = new InputHandlerScalable(); var fireCommand = new FireGunCommand(); inputHandlerScalable.BindInputToCommand(KeyCode.X, fireCommand); //Alternative Fire Button inputHandlerScalable.BindInputToCommand(KeyCode.R, fireCommand); InputHandler inputHandler = new InputHandler(new JumpCommand(), new WeaponSwitchCommand()); IGameObjectCommand command = inputHandler.HandleInput(); command.Execute(gameObject); //Dictionary<string, int> dictionary = new Dictionary<string, int>(); //dictionary.Add("Hoi", 3); //dictionary["Hoi"] //dictionary.ContainsKey("Hoi") //dictionary.TryGetValue("Hoi", out int result); //foreach (KeyValuePair<string, int> kv in dictionary) //{ // kv.Key // kv.Value //} }
public InputHandler(IGameObjectCommand XButtonCommand, IGameObjectCommand YButtonCommand) { this.XButtonPressed = XButtonCommand; this.YButtonPressed = YButtonCommand; }