コード例 #1
0
 public void EnterTutorialLight()
 {
     tutorialState = "Light";
     currentState  = tutorialState;
     ResetRobotObject();
     //RobotController.reset = true;
     //robotController.enabled = true;
     //while(RobotController.initialized == false){Debug.Log("RobotController.initialized? " + RobotController.initialized);}
     Debug.Log("In state " + tutorialState + " with active robot, " + robotObject.name + " using controller " + robotController.name);
     Debug.Log("Activating LDRs....");
     robotManager.ActivateSensorsOfType("LDR");
     envLightObject = GameObject.Instantiate(envLightPrefab, environment.transform);
     SwitchTutorialButtons();
 }
コード例 #2
0
    public void EnterTask()
    {
        Vector3 envLightPos;

        Debug.Log("EnterTask()");

        if (currentTask == "Task1")        //Or do this by tags?
        {
            ResetRobotObject();
            robotManager.DeactivateSensorsOfType("IR");
            robotManager.DeactivateSensorsOfType("LDR");
            robotManager.DeactivateSensorsOfType("MIC");
            robotManager.DeactivateSensorsOfType("RGB");
            Debug.Log("Deactivated all Sensor Types");

            Debug.Log("Activating LDR, and LDR only...!");
            robotManager.ActivateSensorsOfType("LDR");
            envLightObject = GameObject.Instantiate(envLightPrefab, environment.transform);
            envLightPos    = envLightObject.transform.position;
            envLightPos.x  = 0.0f;
            envLightObject.transform.position = envLightPos;
        }
        else if (currentTask == "Task2")
        {
            ResetRobotObject();
            robotManager.DeactivateSensorsOfType("IR");
            robotManager.DeactivateSensorsOfType("LDR");
            robotManager.DeactivateSensorsOfType("MIC");
            robotManager.DeactivateSensorsOfType("RGB");
            Debug.Log("Deactivated all Sensor Types");

            robotManager.ActivateSensorsOfType("MIC");
            robotManager.ActivateSensorsOfType("IR");
        }
        else if (currentTask == "Task3")
        {
            ResetRobotObject();
            robotManager.DeactivateSensorsOfType("IR");
            robotManager.DeactivateSensorsOfType("LDR");
            robotManager.DeactivateSensorsOfType("MIC");
            robotManager.DeactivateSensorsOfType("RGB");
            Debug.Log("Deactivated all Sensor Types");

            //robotManager.ActivateSensorsOfType("IR");
            TaskThreeWalls();
            robotManager.ActivateSensorsOfType("RGB");
        }
        else if (currentTask == "Task4")
        {
            if (robotObject == null)
            {
                robotObject = GameObject.Find("Robot");
                //If there isn't a robot yet, reset.
                if (robotObject == null)
                {
                    ResetRobotObject();
                }
                robotObject.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
            }
            SetupCameraPOV();
            robotManager.ActivateSensorsOfType("LDR");
            robotManager.ActivateSensorsOfType("IR");
            robotManager.ActivateSensorsOfType("MIC");
            robotManager.ActivateSensorsOfType("RGB");
        }
        taskCanvas.enabled = false;
    }