SetScreenOverlayColor() приватный статический Метод

Sets the color of the screen overlay instantly. Useful to start a fade.
private static SetScreenOverlayColor ( Color newScreenOverlayColor ) : void
newScreenOverlayColor Color /// New screen overlay color. ///
Результат void
    void Start()
    {
        Physics.gravity = new Vector3(0.0f,-9.81f,0.0f);

        fade = GetComponent<CameraFade>();

        fade.SetScreenOverlayColor(FullFadeColor); //setup start fade color
        fade.StartFade(EmptyFadeColor, FadeInTime);
    }
    public void Begin()
    {
        string subID = subIDInputField.text.Trim();
        int    trial = trialDropdown.value;

        Setup(subID, trial);
        CameraFade.SetScreenOverlayColor(Color.black);
        SceneManager.LoadScene("MainRoom");
    }
Пример #3
0
 /// <summary>
 /// When interacted
 /// By the player clicking 'E'
 /// This is what happens
 /// </summary>
 public override void Interact(GameObject player, ShootObjects SOPlayer)
 {
     //if (isPortal) {
     //	return;
     //}
     player.transform.parent.position = linkedTeleporter.transform.position + linkedTeleporter.relativePosition;
     fader.SetScreenOverlayColor(fadeColor);
     beginFadeAt = Time.time;
     faded       = false;
 }
Пример #4
0
 void FixedUpdate()
 {
     //UpdateTOD();
     if (Time.realtimeSinceStartup > fadeTime + lastFade && !faded)
     {
         fader.SetScreenOverlayColor(fadeColor);
         fader.StartFade(clearColor, fadeTime);
         toggleSkybox();
         //Time.timeScale = 1;
         faded = true;
     }
 }
Пример #5
0
    IEnumerator Start()
    {
#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
        originalRotation = transform.localRotation;
#elif UNITY_IPHONE || UNITY_ANDROID
        localRotation = transform.eulerAngles;
#endif
        cameraFade.SetScreenOverlayColor(Color.black);
        cameraFade.StartFade(Color.clear, 2f);

        yield return(new WaitForSeconds(2f));

        iTween.MoveTo(tutorialPanel.gameObject, iTween.Hash(
                          "position", Vector3.zero,
                          "islocal", true,
                          "time", 0.4f,
                          "delay", 0.2f,
                          "easetype", iTween.EaseType.easeOutExpo
                          )
                      );

        // Load gun
        DBAccess.instance.userPrefs.userGun.capacity = DBAccess.instance.userPrefs.userGun.compatibleAmmo[0].magSize;
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(quitKey))
        {
            CameraFade.SetScreenOverlayColor(Color.black);

            if (closeMode == CloseMode.Quit)
            {
                Application.Quit();
            }
            else if (closeMode == CloseMode.EscapeToScene)
            {
                SceneManager.LoadScene(sceneNumber);
            }
        }
    }
Пример #7
0
 void Update()
 {
     if (Input.GetKeyUp(pauseKey))
     {
         if (resetOnKey)
         {
             Debug.Log("Restarting Scene");
             CameraFade.SetScreenOverlayColor(Color.black);
             SceneManager.LoadScene(SceneManager.GetActiveScene().name);
         }
         else
         {
             pause = !pause;
             RefreshPauseState();
         }
     }
 }
    private void Initialize(Configuration c)
    {
        int numberOfExecutions = c.NumberOfExecutions[trial];

        //Debug.Log(iteration);
        //Debug.Log(numberOfExecutions);
        if (iteration >= numberOfExecutions)
        {
            PlayerPrefs.SetInt("iteration", 0);
            CameraFade.SetScreenOverlayColor(Color.black);
            SceneManager.LoadScene("Menu");
            return;
        }

        logger.SetActive(true);

        platform.transform.position = new Vector3(c.PlatformPositions[trial][iteration].x, platform.transform.position.y, c.PlatformPositions[trial][iteration].y);
        player.transform.position   = new Vector3(c.PlayerStartPositions[trial][iteration].x, player.transform.position.y, c.PlayerStartPositions[trial][iteration].y);
        platform.transform.rotation = c.PlayerStartOrientations[trial][iteration];

        float timelimit = c.TrialTimeLimits[trial];

        for (int i = 0; i < orderedLandmarks.Length; i++)
        {
            orderedLandmarks[i].SetActive(c.LandmarkVisibilities[trial]);
        }

        if (c.PlatformVisibilities[trial])
        {
            elevator.transform.position = new Vector3(elevator.transform.position.x, -1.2f, elevator.transform.position.z);
        }

        flags.SetActive(c.FlagVisibilities[trial]);
        platformTrigger.SetActive(c.PlatformTriggerEnabled[trial]);
        hills.SetActive(c.HillVisibilities[trial]);

        timer.trialTime = c.TrialTimeLimits[trial];

        player.GetComponentInChildren <AudioListener>().enabled = c.SoundEffectsEnabled[trial];

        player.GetComponent <AugmentedController>().SetWalkSpeed(c.MovementSpeeds[trial]);
    }
Пример #9
0
    void Awake()
    {
        GameObject cam = GameObject.FindGameObjectWithTag("MainCamera");

        cameraFader = cam.GetComponent <CameraFade> ();
        cameraFader.SetScreenOverlayColor(Color.black);
        cameraFader.StartFade(Color.clear, 3f);
        player = GameObject.FindGameObjectWithTag("Player");

        GameObject musicDir = GameObject.FindGameObjectWithTag("MusicDirector");

        if (musicDir != null)
        {
            musicDirector = musicDir.GetComponent <MusicDirector> ();
        }
        else
        {
            Debug.Log("Cannot find music director");
        }
    }
Пример #10
0
 /// <summary>3
 /// Deal damage to player.ss
 /// </summary>
 /// <param name='damage'>
 /// the amount of damage received.
 /// </param>
 /// <returns>
 /// Whether the player survived.
 /// </returns>
 public bool Damage(float damage, DamageCause COD = DamageCause.Default)
 {
     lastInjury = Time.time;
     if (playSounds)
     {
         painSoundSource.PlayOneShot(painSounds[(int)(Random.value * (painSounds.Length - 1))]);
     }
     fader.SetScreenOverlayColor(fadeColor);
     fader.StartFade(transparent, fadeTime);
     lastCOD = COD;
     if (damage >= HealthLevel)
     {
         Die();
         return(false);
     }
     else
     {
         HealthLevel = HealthLevel - damage;
         return(true);
     }
 }
Пример #11
0
    void OnGUI()
    {
        if (!on)
        {
            return;
        }

        if (lastResequenceTime
            + (state == RISC.FadingToBlack ? fadeTime : 0)
            + (state == RISC.DisplayingSplash ? splashTime : 0)
            + (state == RISC.BackToBlack ? fadeTime : 0)
            < Time.time)
        {
            state++;
            lastResequenceTime = Time.time;
            if (state == RISC.DisplayingSplash)
            {
                fader.StartFade(transparency, fadeTime);
            }
            if (state == RISC.BackToBlack)
            {
                fader.StartFade(fadeOutColour, fadeTime);
            }
        }

        if (state == RISC.DisplayingSplash)
        {
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), SplashScreen);
        }
        if (state == RISC.BackToBlack)
        {
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), SplashScreen);
        }
        if (state == RISC.Done)
        {
            fader.SetScreenOverlayColor(fadeOutColour);
            Application.LoadLevel(2);
        }
    }
Пример #12
0
    void OnGUI()
    {
        if (!on)
        {
            return;
        }

        if (lastResequenceTime
            + (state == IS.DisplayingSplash ? splashTime : 0)
            + (state == IS.BackToBlack ? fadeTime : 0)
            < Time.time)
        {
            state++;
            lastResequenceTime = Time.time;
            if (state == IS.BackToTrans)
            {
                fader.StartFade(transparency, fadeTime);
            }
            if (state == IS.BackToBlack)
            {
                fader.StartFade(fadeOutColour, fadeTime);
            }
        }

        if (state == IS.DisplayingSplash)
        {
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), SplashScreen);
        }
        if (state == IS.BackToBlack)
        {
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), SplashScreen);
        }
        if (state == IS.Done)
        {
            fader.SetScreenOverlayColor(transparency);
            on            = false;
            pilot.talking = true;
        }
    }
Пример #13
0
    /// <summary>
    /// Deal damage to player.ss
    /// </summary>
    /// <param name='damage'>
    /// the amount of damage received.
    /// </param>
    /// <returns>
    /// Whether the player survived.
    /// </returns>
    public bool Damage(float damage)
    {
        lastInjury = Time.time;
        if (playSounds)
        {
            painSoundSource.PlayOneShot(painSounds[(int)(Random.value * (painSounds.Length - 1))]);
        }
        fader.SetScreenOverlayColor(fadeColor);
        fader.StartFade(transparent, fadeTime);

        if (damage > HealthLevel)
        {
            HealthLevel = 0;
            print("Debug: Dead.");
            pauseController.pane = "/Dead";
            Time.timeScale       = 0;
            return(false);
        }
        else
        {
            HealthLevel = HealthLevel - damage;
            return(true);
        }
    }
Пример #14
0
        public void Explode()
        {
            Color white  = new Color(1, 1, 1, 1);
            Color whitef = new Color(1, 1, 1, 0);

            weapon.vessel.GetHeightFromTerrain();

            blastRadius = weapon.blastRadius;
            blastPower  = weapon.blastPower;
            blastHeat   = weapon.blastHeat;

            Vector3    position  = transform.position;
            Vector3    direction = transform.up;
            Quaternion rotation  = Quaternion.LookRotation(VectorUtils.GetUpDirection(position));

            if (!hasExploded && weapon.TimeFired >= weapon.dropTime && weapon.vessel.heightFromTerrain >= 70000)
            {
                hasExploded = true;

                if (part != null)
                {
                    part.temperature = part.maxTemp + 100;
                }

                GameObject lightBall = new GameObject();
                lightBall.SetActive(true);
                lightBall.transform.position = position;
                lightBall.transform.rotation = rotation;
                Detonator sdetonator = lightBall.AddComponent <Detonator>();
                lightBall.GetComponent <Detonator>().enabled = true;
                sdetonator.duration = 2f;
                sdetonator.size     = blastRadius;
                sdetonator.detail   = 10f;

                Debug.Log("Space Explosion Activated");
            }
            else
            {
                if (!hasExploded && weapon.vessel.heightFromTerrain <= 69999 && weapon.vessel.heightFromTerrain >= 501 && weapon.TimeFired >= weapon.dropTime && weapon.blastRadius >= 1000)
                {
                    hasExploded = true;

                    if (part != null)
                    {
                        part.temperature = part.maxTemp + 100;
                    }

                    GameObject source = new GameObject();
                    source.SetActive(true);
                    source.transform.position = position;
                    source.transform.rotation = rotation;
                    source.transform.up       = direction;
                    ///Detonator ndetonator = source.AddComponent<Detonator>();
                    //source.GetComponent<Detonator>().enabled = true;
                    //ndetonator.duration = 5.0f;
                    //ndetonator.size = blastRadius;
                    //ndetonator.detail = 10.0f;
                    CameraFade flashEffect = source.AddComponent <CameraFade>();
                    source.GetComponent <CameraFade>().enabled = true;
                    flashEffect.SetScreenOverlayColor(white);
                    flashEffect.StartFade(whitef, 2.0f);
                    ExplosionFx.CreateExplosion(position, blastPower, explAirPath, explSoundPath, isMissile = true, caliber = 0, explosivePart = null, direction = default(Vector3));

                    Debug.Log("Air NExplosion Activated");
                }
                else
                {
                    if (!hasExploded && weapon.vessel.heightFromTerrain <= 69999 && weapon.vessel.heightFromTerrain >= 501 && weapon.TimeFired >= weapon.dropTime && weapon.blastRadius <= 1000)
                    {
                        hasExploded = true;

                        if (part != null)
                        {
                            part.temperature = part.maxTemp + 100;
                        }

                        GameObject csource = new GameObject();
                        csource.SetActive(true);
                        csource.transform.position = position;
                        csource.transform.rotation = rotation;
                        csource.transform.up       = direction;
                        //Detonator cdetonator = csource.AddComponent<Detonator>();
                        //csource.GetComponent<Detonator>().enabled = true;
                        //cdetonator.duration = 3.0f;
                        //cdetonator.size = blastRadius;
                        //cdetonator.detail = 10.0f;
                        ExplosionFx.CreateExplosion(position, blastPower, explAirPath, explSoundPath, isMissile = true, caliber = 0, explosivePart = null, direction = default(Vector3));

                        Debug.Log("Air CExplosion Activated");
                    }
                    else
                    {
                        if (!hasExploded && weapon.TimeFired >= weapon.dropTime && weapon.vessel.heightFromTerrain <= 500 && weapon.blastRadius >= 1000)
                        {
                            hasExploded = true;

                            if (part != null)
                            {
                                part.temperature = part.maxTemp + 100;
                            }

                            GameObject source = new GameObject();
                            source.SetActive(true);
                            source.transform.position = position;
                            source.transform.rotation = rotation;
                            source.transform.up       = direction;
                            //Detonator ndetonator = source.AddComponent<Detonator>();
                            //source.GetComponent<Detonator>().enabled = true;
                            //ndetonator.duration = 5.0f;
                            //ndetonator.size = blastRadius;
                            //ndetonator.detail = 10.0f;
                            CameraFade flashEffect = source.AddComponent <CameraFade>();
                            source.GetComponent <CameraFade>().enabled = true;
                            flashEffect.SetScreenOverlayColor(white);
                            flashEffect.StartFade(whitef, 2.0f);
                            ExplosionFx.CreateExplosion(position, blastPower, explGroundPath, explSoundPath, isMissile = true, caliber = 0, explosivePart = null, direction = default(Vector3));

                            Debug.Log("Ground NExplosion Activated");
                        }
                        else
                        {
                            if (!hasExploded && weapon.TimeFired >= weapon.dropTime && weapon.vessel.heightFromTerrain <= 500 && weapon.blastRadius <= 1000)
                            {
                                hasExploded = true;

                                if (part != null)
                                {
                                    part.temperature = part.maxTemp + 100;
                                }

                                GameObject csource = new GameObject();
                                csource.SetActive(true);
                                csource.transform.position = position;
                                csource.transform.rotation = rotation;
                                csource.transform.up       = direction;
                                //Detonator cdetonator = csource.AddComponent<Detonator>();
                                //csource.GetComponent<Detonator>().enabled = true;
                                //cdetonator.duration = 3.0f;
                                //cdetonator.size = blastRadius;
                                //cdetonator.detail = 10.0f;
                                ExplosionFx.CreateExplosion(position, blastPower, explGroundPath, explSoundPath, isMissile = true, caliber = 0, explosivePart = null, direction = default(Vector3));

                                Debug.Log("Ground CExplosion Activated");
                            }
                        }
                    }
                }
            }
        }