예제 #1
0
    private void routeControl()
    {
        routeSelected = false;

        if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
        {
            controlScript.prevRoute();
        }
        else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow))
        {
            controlScript.nextRoute();
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            routeSelected = true;
        }

        if (controlScript.activeRouteLabel != null)
        {
            routeDataLabel.text = controlScript.activeRouteLabel.text;
        }

        if (routeSelected)
        {
            waypointControl();
        }
    }
예제 #2
0
    //This is for controlling the main selection
    public void getInput()
    {
        if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow))
        {
            //If we are navigating the main menu
            if (mainMenuSelect == false && agentMenuSelect == false)
            {
                Debug.Log(menuPoint);
                menuPoint--;
            }
            //If we are navigating the action menu
            else if (agentActionSelect == true)
            {
                actionPoint--;
            }
        }
        if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))
        {
            //If we are navigating the main menu
            if (mainMenuSelect == false && agentMenuSelect == false)
            {
                Debug.Log(menuPoint);
                menuPoint++;
            }
            //If we are navigating the action menu
            else if (agentActionSelect == true)
            {
                actionPoint++;
            }
        }


        if (Input.GetKeyDown(KeyCode.D) || Input.GetKey(KeyCode.LeftArrow))
        {
            //If we are navigating the agent select
            if (agentMenuSelect && !agentActionSelect)
            {
                //Navigates the possible agents
                userControl.NextAgent();
            }
            else if (settingSelect)
            {
            }
            //If we are navigating the agent action menu
            else if (agentActionSelect)
            {
                //If we are changing routes
                if (actionPoint == 0)
                {
                    //Gets next route
                    userControl.nextRoute();

                    if (userControl.activeRouteLabel != null)
                    {
                        //routeDataLabel.text = userControl.activeRouteLabel.text;
                        uiHandler.routeDataLabel.text = userControl.activeRouteLabel.text;
                    }
                }
                //Navigating Waypoints
                else if (actionPoint == 1)
                {
                    //Gets next waypoint
                    userControl.nextWayPoint();

                    if (userControl.activeRouteLabel != null)
                    {
                        //waypointDataLabel.text = userControl.activeWayPointLabel.text;
                        uiHandler.waypointDataLabel.text = userControl.activeWayPointLabel.text;
                    }
                }
                //Navigating Tasks
                else if (actionPoint == 4)
                {
                    //Gets next task
                    userControl.nextTask();

                    if (userControl.activeRouteLabel != null)
                    {
                        //taskDataLabel.text = userControl.activeTaskLabel.text;
                        uiHandler.taskDataLabel.text = userControl.activeTaskLabel.text;
                    }
                }
            }
        }
        else if (Input.GetKeyDown(KeyCode.A) || Input.GetKey(KeyCode.RightArrow))
        {
            //If we are navigating the agent select
            if (agentMenuSelect && !agentActionSelect)
            {
                //Gets the previous agent
                userControl.PrevAgent();
            }
            else if (settingSelect)
            {
            }

            //If we are navigating the action select
            else if (agentActionSelect)
            {
                //Navigating Routes
                if (actionPoint == 0)
                {
                    userControl.prevRoute();

                    if (userControl.activeRouteLabel != null)
                    {
                        //routeDataLabel.text = userControl.activeRouteLabel.text;
                        uiHandler.routeDataLabel.text = userControl.activeRouteLabel.text;
                    }
                }
                //Navigating Waypoints
                else if (actionPoint == 1)
                {
                    //Gets the previous waypoint
                    userControl.prevWayPoint();

                    if (userControl.activeRouteLabel != null)
                    {
                        //waypointDataLabel.text = userControl.activeWayPointLabel.text;
                        uiHandler.waypointDataLabel.text = userControl.activeWayPointLabel.text;
                    }
                }
                //Navigating Tasks
                else if (actionPoint == 4)
                {
                    //Gets the previous task
                    userControl.prevTask();

                    if (userControl.activeRouteLabel != null)
                    {
                        //taskDataLabel.text = userControl.activeTaskLabel.text;
                        uiHandler.taskDataLabel.text = userControl.activeTaskLabel.text;
                    }
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            //Hitting C over a main menu option will now open the next part of the menu
            mainMenuSelect = true;
            if (agentMenuSelect == true)
            {
                agentActionSelect = true;
                //This makes the routes display when the action menu pops up
                uiHandler.routeDataLabel.text    = userControl.activeRouteLabel.text;
                uiHandler.waypointDataLabel.text = userControl.activeWayPointLabel.text;
                uiHandler.taskDataLabel.text     = userControl.activeTaskLabel.text;
            }
            Debug.Log("Setting selection" + mainMenuSelect);
        }


        if (Input.GetKeyDown(KeyCode.B))
        {
            //If we are in action select and want to go back
            if (mainMenuSelect == true && agentMenuSelect == true && agentActionSelect == true)
            {
                agentActionSelect = false;
                //If we are in the agent select and want to go back
            }
            else if (mainMenuSelect == true && agentMenuSelect == true && agentActionSelect == false)
            {
                agentMenuSelect = false;
                mainMenuSelect  = false;
            }
            else if (mainMenuSelect == true)
            {
                mainMenuSelect = false;
            }
            cameraMove.setSelect = false;
            uiHandler.mainMenuUI();
        }


        if (Input.GetKeyDown(KeyCode.KeypadPlus) || Input.GetKeyDown(KeyCode.Equals))
        {
            Debug.Log("Plus pressed");
            //If we confirm while over the waypoints, set the current agents waypoint
            if (actionPoint == 1)
            {
                //Add code to store the actual waypoint data
                userControl.selectedAgent.setNavTarget(userControl.activeWayPoint);
                userControl.activeAgentDataLabel.text = uiHandler.waypointDataLabel.text;
                //This might need to be changed
                userControl.PushWayPointToAgent();
                Debug.Log("Plus pressed inside waypoint");
            }
            else if (actionPoint == 4)
            {
                uiHandler.taskDataLabel.text = userControl.activeTaskLabel.text;

                if (uiHandler.taskDataLabel.text == "Task: moveNow")
                {
                    moving = true;
                }

                //userControl.activeTaskLabel.text = taskDataLabel.text;
                userControl.PushTaskToAgent();
            }
        }

        if (moving)
        {
            taskToDo.doTask("moveNow");
        }
    }