Ejemplo n.º 1
0
    public void AssignKeyTest()
    {
        GameInput.Bind(Controls.SHIP_X_AXIS_POS, KeyCode.W);

        var key = GameInput.GetBinding(Controls.SHIP_X_AXIS_POS);

        Assert.AreEqual(KeyCode.W, key);
    }
Ejemplo n.º 2
0
        public CommandResult Bind(string control, string key)
        {
            Controls controlValue = (Controls)Enum.Parse(typeof(Controls), control, true);
            KeyCode  keyValue     = (KeyCode)Enum.Parse(typeof(KeyCode), key, true);

            if (!Enum.IsDefined(typeof(KeyCode), keyValue))
            {
                Debug.LogWarning("Invalid keycode");
                return(CommandResult.Failure);
            }
            if (!Enum.IsDefined(typeof(Controls), controlValue))
            {
                Debug.LogWarning("Invalid control");
                return(CommandResult.Failure);
            }

            GameInput.Bind(controlValue, keyValue);
            return(CommandResult.Success);
        }
Ejemplo n.º 3
0
 void Start()
 {
     GameInput.Bind(Controls.CONSOLE, KeyCode.BackQuote);
     GameInput.Bind(Controls.SUBMIT, KeyCode.Return);
     GameInput.Bind(Controls.SHIP_X_AXIS_POS, KeyCode.W);
 }