using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class KeyBindingHolder : IBindingHolder { public Dictionary InputBindings { get; private set; } private readonly Dictionary DefaultKeyBindings = new Dictionary { {ECommand.NONE, new KeyBinding(KeyCode.None)}, {ECommand.DOWN, new KeyBinding(KeyCode.DownArrow)}, {ECommand.UP, new KeyBinding(KeyCode.UpArrow)}, {ECommand.LEFT, new KeyBinding(KeyCode.LeftArrow)}, {ECommand.RIGHT, new KeyBinding(KeyCode.RightArrow)}, {ECommand.OPEN_SCOREBOARD, new KeyBinding(KeyCode.Tab)}, {ECommand.OPEN_PAUSE_MENU, new KeyBinding(KeyCode.Escape)} }; private readonly Dictionary Player2KeyBindings = new Dictionary { {ECommand.DOWN2, new KeyBinding(KeyCode.S)}, {ECommand.UP2, new KeyBinding(KeyCode.Z)}, {ECommand.LEFT2, new KeyBinding(KeyCode.Q)}, {ECommand.RIGHT2, new KeyBinding(KeyCode.D)}, }; public void Init(Boolean isPlayer2) { if (InputBindings == null) if (isPlayer2) { InputBindings = Player2KeyBindings; } else { InputBindings = DefaultKeyBindings; } } }