Esempio n. 1
0
 void dayTime()
 {
     GameObject[] gameObjectArray = GameObject.FindGameObjectsWithTag("lamp");
     fade.FadeIn(false);
     foreach (GameObject go in gameObjectArray)
     {
         go.GetComponent <Renderer>().material = dayMaterial;
         go.transform.FindChild("Point light").gameObject.SetActive(true);
     }
     headLamp.SetActive(false);
     fade.FadeOut(false);
 }
Esempio n. 2
0
 private void OnFadeComplete()
 {
     if (m_fading)
     {
         m_fading = false;
         MoveCamera();
         VRCameraFade cameraFade = m_Camera.GetComponent <VRCameraFade>();
         cameraFade.FadeIn(false);
     }
 }
Esempio n. 3
0
    IEnumerator HandleJWST1()
    {
        canClick = false;
        JWT2.gameObject.SetActive(false);
        orbit.target = JWT1.transform;
        panelAnimation.SetActive(false);
        yield return(new WaitForSeconds(anim1.GetCurrentAnimatorStateInfo(0).length));

        fade.FadeIn(false);
        currentAnim = 1;
        ClickNext();
        panelAnimation.SetActive(true);
        canClick = true;
        JWT1.gameObject.SetActive(false);
        JWT2.gameObject.SetActive(true);
        orbit.target = JWT2.transform;
    }
Esempio n. 4
0
    //Obsługa teleportu
    private void Teleport()
    {
        // Create a ray that points forwards from the camera.
        Ray        ray = new Ray(m_Camera.position, m_Camera.forward);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, m_RayLength, ~m_ExclusionLayers))
        {
            Vector3 location = new Vector3(hit.point.x, hit.point.y + 1.8f, hit.point.z);
            if (hit.point.y < 0.1f)
            {
                VRCameraFade fade = gameObject.GetComponent(typeof(VRCameraFade)) as VRCameraFade;
                if (fade != null)
                {
                    fade.FadeIn(false);
                }
                gameObject.transform.position = location;
                if (fade != null)
                {
                    fade.FadeOut(false);
                }
            }
        }
    }
Esempio n. 5
0
 void MoveTo()
 {
     transform.position    = playerPosition;
     fader.OnFadeComplete -= MoveTo;
     fader.FadeIn(true);
 }
    void OnLevelWasLoaded(int level)
    {
        switch (level)
        {
        case 0:     //Start
            Debug.Log("Scene Loaded: StartScene");

            break;

        case 1:     //Lobby
            Debug.Log("Scene Loaded: Lobby");

            if (motionBase != null)
            {
                motionBase.transform.position = new Vector3(0.0f, 1.3f, 0.0f);
            }

            lobbyInstructions = GameObject.FindGameObjectWithTag("LobbyInstructions");
            lobbyInstructions.SetActive(false);

            breakInstructions = GameObject.FindGameObjectWithTag("BreakInstructions");
            breakInstructions.SetActive(false);

            finishedInstructions = GameObject.FindGameObjectWithTag("FinishedInstructions");
            finishedInstructions.SetActive(false);

            SelectionSlider slider = lobbyInstructions.GetComponentInChildren <SelectionSlider>();
            slider.OnBarFilled += slider_OnBarFilled;

            SelectionSlider slider2 = breakInstructions.GetComponentInChildren <SelectionSlider>();
            slider2.OnBarFilled += slider_OnBarFilled;

            targetOne = GameObject.FindGameObjectWithTag("TargetOne");
            targetTwo = GameObject.FindGameObjectWithTag("TargetTwo");

            if (targetOne != null && targetTwo != null)
            {
                targetOneImage = targetOne.GetComponentInChildren <Image>();
                targetTwoImage = targetTwo.GetComponentInChildren <Image>();

                targetOneImage.CrossFadeAlpha(0.0f, 0.1f, true);
                targetTwoImage.CrossFadeAlpha(0.0f, 0.1f, true);

                targetOne.SetActive(false);
                targetTwo.SetActive(false);

                targetOneFadedOut = true;
                targetTwoFadedOut = true;
            }

            if (runNumber > 0 && runNumber % numberOfRunsBeforeBreak == 0)
            {
                breakInstructions.SetActive(true);
                onBreak = true;
            }

            cameraFade.FadeIn(false);
            break;

        case 2:     //City
            Debug.Log("Scene Loaded: City");

            condition = conditions.Dequeue();

            if (recorder != null && !recorder.currentelyRecording())
            {
                recorder.startRecording("PedSimCity_" + participantID + "_Run" + runNumber + "_Condition" + condition);
            }

            trafficLightChangeDelay = originalTrafficChangeDelay;

            if (motionBase != null)
            {
                motionBase.transform.position = motionBaseStartPosition;
                if (runNumber > 0)
                {
                    motionBase.transform.Rotate(Vector3.up, 180f);
                }
            }

            if (guiArrows != null)
            {
                guiArrows.Hide();
            }

            controller = GameObject.FindGameObjectWithTag("TrialIntersection").GetComponent <IntersectionController>();

            targetVehicle = GameObject.FindGameObjectWithTag("TrialVehicle");

            //period that the pedestrain light counts down to RED/DON'T WALK in s
            //float pedestrianChangeInterval = streetWidth / walkingSpeed;

            //time from start of vehicle movement to ped light green, in s
            float goSignalDelay = fadeInDelay + trafficLightChangeDelay + trafficLightYellowInterval + vehicleClearanceInterval + walkInterval;

            Debug.Log("Go signal delay: " + goSignalDelay);

            timer = goSignalDelay;

            //if condition == 0, we are in the no car condition, disable target car
            if (condition == 0)
            {
                targetVehicle.SetActive(false);
                Debug.Log("Condition 0: trial car disabled.");
            }
            else
            {
                float trialCarOffset = calculateTrialCarOffset(goSignalDelay);

                Debug.Log("Condition " + condition + ":");
                Debug.Log("trial car offset: " + trialCarOffset);

                //if we're an even condition we need to flip the car around for the near lane trials
                if (condition % 2 == 0)
                {
                    targetVehicle.transform.Rotate(Vector3.up, 180);
                    targetVehicle.transform.position = new Vector3(targetVehicle.transform.position.x, 0, -49.8f);
                }

                Vector3 trialCarPosition = new Vector3(targetVehicle.transform.position.x + trialCarOffset, 0, targetVehicle.transform.position.z);

                targetVehicle.transform.position = trialCarPosition;

                Debug.Log("new trial car position: " + trialCarPosition.ToString());
            }
            cameraFade.FadeIn(false);
            break;

        default:
            Debug.Log("Scene Loaded: " + level);
            break;
        }
    }