예제 #1
0
    void Update()
    {
#if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.B))
        {
            BackToSetup();
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            UnityEditor.EditorApplication.isPlaying = false;
        }
#endif
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }
        for (int i = 0; i < GameConstants.MAX_ROBOTS_ON_SQUAD; i++)
        {
            if (Input.GetKeyDown(KeyCode.Alpha1 + i))
            {
                robotButtonContainer.Get(i).Click();
            }
        }
        if (Input.GetKeyDown(KeyCode.Q))
        {
            commandButtonContainer.GetByName(Command.GetDisplay(Command.SPAWN_COMMAND_ID)).Click();
        }
        else if (Input.GetKeyDown(KeyCode.M))
        {
            commandButtonContainer.GetByName(Command.GetDisplay(Command.MOVE_COMMAND_ID)).Click();
        }
        else if (Input.GetKeyDown(KeyCode.A))
        {
            commandButtonContainer.GetByName(Command.GetDisplay(Command.ATTACK_COMMAND_ID)).Click();
        }
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            directionButtonContainer.GetByName(Command.byteToDirectionString[Command.UP]).Click();
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            directionButtonContainer.GetByName(Command.byteToDirectionString[Command.LEFT]).Click();
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            directionButtonContainer.GetByName(Command.byteToDirectionString[Command.DOWN]).Click();
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            directionButtonContainer.GetByName(Command.byteToDirectionString[Command.RIGHT]).Click();
        }
        if (Input.GetKeyDown(KeyCode.Return))
        {
            submitCommands.Click();
        }
    }