internal virtual void Start()
 {
     //set the initial view
     this.InitializeViews();
     //get a reference to the primary vehicle's eye cameras
     leftEyeCamera  = primaryVehicle.gameObject.GetChildObjectByName("LeftEyeCamera").GetComponent <Camera>();
     rightEyeCamera = primaryVehicle.gameObject.GetChildObjectByName("RightEyeCamera").GetComponent <Camera>();
     //get a reference to the vehicle's retinas
     leftEyeRetina  = leftEyeCamera.GetComponent <Retina>();
     rightEyeRetina = rightEyeCamera.GetComponent <Retina>();
     trails         = GameObject.FindObjectsOfType <TrailRenderer>();
     foreach (TrailRenderer trail in trails)
     {
         //trail.enabled = true;
         trail.enabled = this.showTrail;
     }
     //determine whether the eye view UI is rendered
     this.eyeViewUI.SetActive(this.showEyeCameras);
     //determine whether the eye view UI will show the average eye color
     leftEyeRetina.showUniform  = this.showProcessedInformation;
     rightEyeRetina.showUniform = this.showProcessedInformation;
     //determine whether the instruction screen is visible
     instructionScreen.SetActive(this.showInstructionUI);
     //determine whether the info UI is visible. The info UI has priority over the instruction screen.
     if (this.showInfoUI == true)
     {
         instructionScreen.SetActive(false);
         this.infoUI.SetActive(true);
         this.showInstructionUI = false;
     }
     else
     {
         this.infoUI.SetActive(false);
     }
 }
Beispiel #2
0
    private float lastEyeTestTime = 0f;                //the time of the last eye test

    void Awake()
    {
        //get a reference to the vehicle component
        vehicle = GetComponent <Vehicle> ();
        if (vehicle == null)
        {
            vehicle = this.GetComponentInParent <Vehicle> ();
        }
        //get a reference to the directional light
        this.directionalLight = GameObject.FindGameObjectWithTag(TagManager.DirectionalLight).GetComponent <Light> ();
        if (this.eyeTest.enabled)
        {
            this.eyeTest.Initialize();
        }
        //get a reference to the retina
        if (this.eyeType == null)
        {
            Debug.LogError("Null reference for eye type.");
            return;
        }
        foreach (Retina r in this.GetComponentsInChildren <Retina>())
        {
            if (r.eyeType == this.eyeType)
            {
                this.retina = r;
                break;
            }
        }
        //log error if retina with the appropriate type cannot be found
        if (this.retina == null)
        {
            Debug.LogError("Could not find retina for eye. Are you missing an EyeType reference?");
            return;
        }
        //get a reference to the Camera component.
        _camera         = retina.GetComponent <Camera>();
        _camera.enabled = false;
        // the retina of a complex eye is divided into one row of five columns
        if (this.isComplexEye)
        {
            this.retinalRows    = 1;
            this.retinalColumns = 5;
        }
        else           // a simple eye simply has a single retinal patch
        {
            this.retinalRows    = 1;
            this.retinalColumns = 1;
        }
        this.retinalPatchesVisualInfo = new ColorInformation[this.retinalColumns, this.retinalRows]; //initialize the retinal patches array with the number of columns and number of rows
        this.SetEyeRotation(this.initialEyeRotation);
        this._tag = this.EyeTag;                                                                     // this ensures we cannot change the tag during game play
    }