Ejemplo n.º 1
0
    public void ExecuteCommand()
    {
        if (cmdField.text == null)
        {
            cmdField.ActivateInputField();
            return;
        }

        string userInput = cmdField.text.ToLower().ToString();

        cmdHistory.text = userInput + "\n" + cmdHistory.text;
        char[]   delimiterCharacters = { ' ' };
        string[] separatedInput      = userInput.Split(delimiterCharacters);

        for (int i = 0; i < inputActions.Length; i++)
        {
            InputAction action = inputActions[i];
            if (action.keyWord == separatedInput[0])
            {
                action.InputCommand(separatedInput, FoxCharacter.Instance.gameObject);
            }
        }

        cmdField.text = null;
        cmdField.ActivateInputField();
    }