예제 #1
0
    IEnumerator sea_Exit()
    {
        CursorHide();

        ImageFade.Start(uiImage, 1f, 0f, 0f);
        return(SnoozeFadeOut(alarmWakeUpDelay));
    }
예제 #2
0
    IEnumerator alarm_Enter()
    {
        Camera.main.GetComponent <NoiseAndScratches>().enabled = false;

        alarm_buttonClicked     = false;
        alarm_buttonGroup.alpha = 0f;
        alarm_buttonObject.gameObject.SetActive(false);

        yield return(new WaitForSeconds(1f));

        SoundAlarm();

        float textDelay = story.Vars["again"] ? 1.5f : 4.5f;

        yield return(new WaitForSeconds(textDelay));

        uiImage.sprite = alarm_imgPhone;
        ImageFade.Start(uiImage, 0f, 1f, 4f);

        CursorSet(alarm_cursor, 4f);

        alarm_buttonAnimator.gameObject.SetActive(true);
        alarm_buttonObject.gameObject.SetActive(true);
        alarm_buttonAnimator.SetBool("alarm", true);
        ImageFade.Start(alarm_buttonGroup, this, 0f, 1f, 0.2f);
    }
    public ConstantsAndUtils(Camera camera, Canvas canvas)
    {
        if (camera == null)
        {
            Debug.LogError("Set camera object in inspector");
            return;
        }

        if (canvas == null)
        {
            Debug.LogError("Set canvas object in inspector for the UI and fade in/out");
            return;
        }

        m_OrtographicCamera = camera;
        m_canvas            = canvas;
        m_imgFade           = m_canvas.GetComponent <ImageFade>();
        if (m_imgFade == null)
        {
            Debug.LogError("Set ImageFade object in inspector for the UI and fade in/out");
            return;
        }

        LeftScreenLimit  = m_OrtographicCamera.ScreenToWorldPoint(new Vector2(0 + OFFSET_X, SPAWN_Y));
        RightScreenLimit = m_OrtographicCamera.ScreenToWorldPoint(new Vector2(Screen.width - OFFSET_X, SPAWN_Y));

        LeftScreenLimitX  = LeftScreenLimit.x;
        RightScreenLimitX = RightScreenLimit.x;
    }
예제 #4
0
    IEnumerator street_Enter()
    {
        uiTextPlayer.AutoDisplay = false;
        StartCoroutine(SnoozeFadeOut(snooze_fadeOut));
        uiImage.sprite = street_image;
        ImageFade.Start(uiImage, 0f, 1f, 3f);

        CursorSet(street_cursor, 1f);

        street_lastStepTime    = 0f;
        street_lastClickTime   = 0f;
        street_lastClickSpeed  = 0f;
        street_speed           = street_minSpeed;
        street_FootstepsPaused = false;
        street_walkTime        = 0f;
        street_currentOutput   = 0;
        street_lineShown       = false;
        street_arousalCounter  = -1;
        street_arousalLevel    = 0;

        street_sfxStreet.time = 0f;
        street_sfxStreet.Play();
        const float fadeInTime = 2f;

        for (float t = 0; t <= fadeInTime; t += Time.deltaTime)
        {
            street_sfxStreet.volume = t / fadeInTime;
            yield return(null);
        }
    }
예제 #5
0
    IEnumerator LoadEditor(Dictionary <string, Sprite[]> packedSprites)
    {
        // Fade
        yield return(fader.fadeOut(1.0f));

        Skin skin = new Skin();

        LoadSettingsConfig(skin);

        skin.SetSpriteSheet(packedSprites);

        foreach (var skinItem in resourcesDictionary)
        {
            if (imagesToPack.ContainsKey(skinItem.Key))
            {
                continue;
            }

            skinItem.Value.AssignResource();

            // Add all loaded custom assets into the skin manager. Probably move this whole loading function into there later?
            skin.AddSkinItem(skinItem.Key, skinItem.Value.filepath, skinItem.Value.GetObject());
        }

        SkinManager.Instance.currentSkin = skin;

        // Load editor
        int buildIndex = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex;

        enabled = false;
        fader   = null;
        UnityEngine.SceneManagement.SceneManager.LoadScene(buildIndex + 1);
    }
예제 #6
0
    void her_Update()
    {
        if (her_done)
        {
            return;
        }

        float delta = (Input.mousePosition - her_lastMousePos).magnitude;
        float move  = Mathf.Clamp(delta / Screen.height, 0f, 1f);
        Color color = uiImage.color;

        if (move < her_minScreenMove)
        {
            if (!ImageFade.IsInProgress(uiImage) && color.a > 0f)
            {
                ImageFade.Start(uiImage, 1f, 0f, move < her_minScreenMove ? her_minFadeoutTime : her_maxFadeoutTime);
            }
        }
        else if (!her_lineTriggered)
        {
            ImageFade.Stop(uiImage);

            color.a       = Mathf.Clamp(color.a + move * her_alphaFactor, 0f, 1f);
            uiImage.color = color;
        }

        // Show another line
        if (!her_lineTriggered && color.a >= her_alphaLineTriggerUp)
        {
            TwineText line = null;
            while (line == null)
            {
                TwineOutput output = story.Output[her_outputIndex];
                if (output is TwineText)
                {
                    line = (TwineText)output;
                }
                else if (output is TwineLink && output.Name == "continue")
                {
                    her_done = true;
                    StartCoroutine(her_alarm(output as TwineLink));
                    break;
                }
                her_outputIndex++;
            }

            if (line != null)
            {
                uiTextPlayer.DisplayOutput(line);
                her_lineTriggered = true;
            }
        }
        else if (her_lineTriggered && color.a <= her_alphaLineTriggerDown)
        {
            her_lineTriggered = false;
        }

        her_lastMousePos = Input.mousePosition;
    }
예제 #7
0
        private void RenderVideoNewFrameCompleted(BitmapImage Bitmap)
        {
            ImageFade.BeginAnimation(Image.SourceProperty, null);
            ImageFade.Source = Image.Source;

            (Resources["FadeImageAnimation"] as Storyboard).Begin();
            Image.Source = Bitmap;
        }
예제 #8
0
 private void Awake()
 {
     loadImage    = GetComponentInChildren <Image>();
     loadText     = GetComponentInChildren <TextMeshProUGUI>();
     fade         = GetComponent <ImageFade>();
     fade.HasText = false;
     loadImage.rectTransform.sizeDelta = new Vector2(Screen.currentResolution.width * 1.1f, Screen.currentResolution.height * 1.1f);
     loadText.text = "loadingText";
 }
예제 #9
0
    void sea_Enter()
    {
        sea_current = 0;

        uiImage.sprite = sea_image;
        ImageFade.Start(uiImage, 0f, 1f, 8f);
        StartCoroutine(SnoozeFadeOut(2f, noise: 0f, underwater: 1f));

        CursorSet(sea_cursor, 8f);
    }
예제 #10
0
    void alarm_Exit()
    {
        alarm_sfx.loop = false;

        ImageFade.Start(uiImage, 1f, 0f, 0f);

        alarm_buttonObject.gameObject.SetActive(true);
        alarm_buttonAnimator.SetBool("alarm", false);
        alarm_buttonAnimator.gameObject.SetActive(false);
        ImageFade.Start(alarm_buttonGroup, this, 1f, 0f, 0f);
    }
예제 #11
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
예제 #12
0
    // .............
    // Cursor

    void CursorSet(RectTransform prefab, float fadeIn = 0f)
    {
        Image       img   = null;
        CanvasGroup group = null;

        // Stop any cursor fades
        img   = this.cursor.GetComponentInChildren <Image>();
        group = this.cursor.GetComponentInChildren <CanvasGroup>();

        if (group != null)
        {
            ImageFade.Stop(group, this);
        }
        else if (img != null)
        {
            ImageFade.Stop(img);
        }

        // Remove all cursor content
        for (int i = 0; i < this.cursor.childCount; i++)
        {
            GameObject.Destroy(this.cursor.GetChild(i).gameObject);
        }

        this.cursor.DetachChildren();

        // Create a new cursor
        RectTransform child = Instantiate(prefab);

        child.SetParent(this.cursor);
        child.localPosition = prefab.localPosition;
        child.localScale    = prefab.localScale;

        if (fadeIn > 0f)
        {
            group = child.GetComponent <CanvasGroup>();
            img   = child.GetComponent <Image>();

            if (group != null)
            {
                group.alpha = 0f;
            }
            else if (img != null)
            {
                Color c = img.color;
                c.a       = 0f;
                img.color = c;
            }
        }

        CursorShow(fadeIn);
    }
예제 #13
0
    private void SceneManager_ActiveSceneChanged(Scene a, Scene b)
    {
        // Get the stats screen.
        GameObject stats = GameObject.Find("StatsScreen");
        // Get the game over input component.
        GameOverInput goi = stats.GetComponent <GameOverInput>();

        // Get the image fade and subscribe to it.
        imageFade              = goi.imageFade;
        imageFade.AlphaHitMax += ImageFade_AlphaHitMax;
        // Set the stats text values appropriately.
        goi.textWaves.text         = "You made it to wave " + waveController.GetCurrentWave() + ".";
        goi.textEnemiesKilled.text = "You defeated " + enemiesKilled + " attackers.";
    }
예제 #14
0
    void Awake()
    {
        if(instance && instance.GetInstanceID() != GetInstanceID())
        {
            DestroyImmediate(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }

        if (GameObject.Find("Fade") != null)
        {
            imageFade = GameObject.Find("Fade").GetComponent<ImageFade>();
        }
    }
예제 #15
0
    [SerializeField] private State currentState; //serialized for debugging

    // Start is called before the first frame update
    void Start()
    {
        // Getting all the objects marked Toggleable
        GetActivatableObjs();
        // Getting components from objects
        theGame              = FindObjectOfType <AdventureGame>();
        theBGImage1image     = theBGImage1.GetComponent <Image>();
        theBGImage2image     = theBGImage2.GetComponent <Image>();
        theBGImage2imageFade = theBGImage2.GetComponent <ImageFade>();
        buttonHolderFade     = buttonHolder.GetComponent <ImageFade>();
        rainSource           = rainAudio.GetComponent <AudioSource>();
        musicSource          = musicAudio.GetComponent <AudioSource>();
        rainFilter           = rainAudio.GetComponent <AudioLowPassFilter>();
        musicFilter          = musicAudio.GetComponent <AudioLowPassFilter>();
        masterMixer.GetFloat("masterVolume", out masterVolume);
        // Transitioning to starting state
        NextState(startingState);
    }
예제 #16
0
    void CursorShow(float fadeIn = 0f)
    {
        cursor.gameObject.SetActive(true);

        // Fade in if necessary
        if (fadeIn > 0f)
        {
            CanvasGroup group = this.cursor.GetComponentInChildren <CanvasGroup>();
            Image       img   = this.cursor.GetComponentInChildren <Image>();
            if (group != null)
            {
                ImageFade.Start(group, this, 0f, 1f, fadeIn);
            }
            else if (img != null)
            {
                ImageFade.Start(img, 0f, 1f, fadeIn);
            }
        }
    }
예제 #17
0
    void Awake()
    {
        //Get the supported resolutions
        Resolution[] resolutions = Screen.resolutions;

        //Calculate the max resolution and set it
        int maxResolution = resolutions.Length-1;
        Screen.SetResolution(resolutions[maxResolution].width, resolutions[maxResolution].height, true);

        //Set up the waits
        endWait = new WaitForSeconds(endDelay);
        fastWait = new WaitForSeconds(fastDelay);

        //Disable the tribal
        moveTribal.SetActive(false);
        fader.SetActive(false);

        //Initialize components
        imageFade = fader.GetComponent<ImageFade>();
    }
예제 #18
0
    void alarm_Exit()
    {
        alarm_sfx.loop = false;

        const float alarmStopTime = 0.1f;

        ImageFade.Start(uiImage, 1f, 0f, alarmStopTime);
        ImageFade.Start(alarm_buttonGroup, this, 1f, 0f, alarmStopTime);
        CursorHide(alarmStopTime);
        CursorHoverClear(
            new StoryLink[] { story.GetCurrentLinks().Where(link => link.PassageName == "getUp").First() },
            new GameObject[] { alarm_buttonObject.gameObject }
            );

        //yield return new WaitForSeconds(alarmStopTime);

        alarm_buttonObject.gameObject.SetActive(false);
        alarm_buttonAnimator.SetBool("alarm", false);
        alarm_buttonAnimator.gameObject.SetActive(false);
    }
예제 #19
0
    // Start is called before the first frame update
    void Start()
    {
        first_stop            = false;
        elevatorButtonPressed = false;
        anim = GetComponent <Animator>();
        cam  = Camera.main;
        encounter_meteors  = false;
        allbloodcellscured = false;
        ImageFade image = GameObject.FindGameObjectWithTag("UI").GetComponent <ImageFade>();

        postCrossFade = false;



        //Coroutine Approach

        /*
         * StartCoroutine(OnWaitAnimation("CINEMA_4D_Main"));
         * anim.SetBool("Start", true);
         */
    }
예제 #20
0
    void CursorHide(float fadeOut = 0f)
    {
        // Fade out if necessary
        if (fadeOut > 0f)
        {
            CanvasGroup group = this.cursor.GetComponentInChildren <CanvasGroup>();
            Image       img   = this.cursor.GetComponentInChildren <Image>();
            if (group = null)
            {
                ImageFade.Start(group, this, 1f, 0f, fadeOut, () => this.cursor.gameObject.SetActive(false));
                return;
            }
            else if (img != null)
            {
                ImageFade.Start(img, 1f, 0f, fadeOut, () => this.cursor.gameObject.SetActive(false));
                return;
            }
        }

        this.cursor.gameObject.SetActive(false);
    }
예제 #21
0
    IEnumerator alarm_Enter()
    {
        alarm_buttonClicked     = false;
        alarm_buttonGroup.alpha = 0f;
        alarm_buttonObject.gameObject.SetActive(false);

        yield return(new WaitForSeconds(1f));

        SoundAlarm();

        float textDelay = story["again"] ? 1.5f : 4.5f;

        yield return(new WaitForSeconds(textDelay));

        uiImage.sprite = alarm_imgPhone;
        ImageFade.Start(uiImage, 0f, 1f, 4f);

        alarm_buttonAnimator.gameObject.SetActive(true);
        alarm_buttonObject.gameObject.SetActive(true);
        alarm_buttonAnimator.SetBool("alarm", true);
        ImageFade.Start(alarm_buttonGroup, this, 0f, 1f, 0.2f);
    }
예제 #22
0
    IEnumerator street3_Exit()
    {
        CursorHide();
        StopCoroutine(street_arousalCoroutine);

        AudioLowPassFilter[] lowPass = new AudioLowPassFilter[] {
            street_sfxFootstep1.GetComponent <AudioLowPassFilter>(),
            street_sfxFootstep2.GetComponent <AudioLowPassFilter>(),
            street_sfxStreet.GetComponent <AudioLowPassFilter>()
        };

        for (int i = 0; i < lowPass.Length; i++)
        {
            lowPass[i].enabled = false;
        }

        _bloom.intensity = _bloomBaseValue;
        uiImage.color    = Color.white;
        ImageFade.Start(uiImage, 1f, 0f, 0.1f);
        uiTextPlayer.AutoDisplay = true;
        return(SnoozeFadeOut(alarmWakeUpDelay));
    }
예제 #23
0
        //OnTriggerEnter2D is sent when another object enters a trigger collider attached to this object (2D physics only).
        private void OnTriggerEnter2D(Collider2D other)
        {
            //Check if the tag of the trigger collided with is Exit.
            if (other.tag == "Exit")
            {
                TrackerManager.ClearedLevel(GameManager.instance.level, "Food ", food, "Time", GameManager.instance.time);
                ImageFade.FadeOut(restartLevelDelay);
                // Invoke the Restart function to start the next level with a delay of restartLevelDelay (default 1 second).
                Invoke("Restart", restartLevelDelay);

                //Disable the player object since level is over.
                enabled = false;
            }

            //Check if the tag of the trigger collided with is Food.
            else if (other.tag == "Food")
            {
                Analytics.CustomEvent("Food Picked Up");
                //Add pointsPerFood to the players current food total.
                food += pointsPerFood;

                ValueSetter.maximum += pointsPerFood;

                //Update foodText to represent current total and notify player that they gained points
                foodText.text = " Food:   " + food;

                //Call the RandomizeSfx function of SoundManager and pass in two eating sounds to choose between to play the eating sound effect.
                SoundManager.instance.RandomizeSfx(eatSound1, eatSound2);

                //Disable the food object the player collided with.
                other.gameObject.SetActive(false);
            }

            //Check if the tag of the trigger collided with is Soda.
            else if (other.tag == "Soda")
            {
                Analytics.CustomEvent("Food Picked Up");
                Analytics.CustomEvent("Soda Picked Up");
                //Add pointsPerSoda to players food points total
                food += pointsPerSoda;
                ValueSetter.maximum += pointsPerSoda;

                //Update foodText to represent current total and notify player that they gained points
                foodText.text = " Food:   " + food;

                //Call the RandomizeSfx function of SoundManager and pass in two drinking sounds to choose between to play the drinking sound effect.
                SoundManager.instance.RandomizeSfx(drinkSound1, drinkSound2);

                //Disable the soda object the player collided with.
                other.gameObject.SetActive(false);
            }
            // Check if the player is colliding with an ore
            else if (other.tag == "Ores")
            {
                switch (other.name)
                {
                // add a diamond ore, and disable the gameobject
                case "Diamond(Clone)":
                    TrackerManager.ItemPickUp(other.name);
                    GameManager.instance.diamondPoints++;
                    diamondCount++;
                    inventoryText[0].text = "x" + "\n" + "\n" + diamondCount;
                    other.gameObject.SetActive(false);
                    break;

                // add a gold ore, and disable the gameobject
                case "Gold(Clone)":
                    TrackerManager.ItemPickUp(other.name);
                    GameManager.instance.goldPoints++;
                    goldCount++;
                    inventoryText[2].text = "x" + "\n" + "\n" + goldCount;
                    other.gameObject.SetActive(false);
                    break;

                // add a iron ore, and disable the gameobject
                case "Iron(Clone)":
                    TrackerManager.ItemPickUp(other.name);
                    GameManager.instance.ironPoints++;
                    ironCount++;
                    inventoryText[1].text = "x" + "\n" + "\n" + ironCount;
                    other.gameObject.SetActive(false);
                    break;

                default:
                    break;
                }
            }
        }
예제 #24
0
        protected static void CreateImageFade()
        {
            GameObject go = CreateGameObject("ImageFade", true);

            ImageFade image = go.AddComponent <ImageFade>();
        }
예제 #25
0
 void her_Exit()
 {
     CursorHide(0.1f);
     ImageFade.Start(uiImage, 1f, 0f, 0.1f);
     uiTextPlayer.AutoDisplay = true;
 }
예제 #26
0
    void her_Update()
    {
        if (her_done)
        {
            return;
        }

        float delta = (Input.mousePosition - her_lastMousePos).magnitude;
        float move  = Mathf.Clamp(delta / Screen.height, 0f, 1f);
        Color color = uiImage.color;

        if (move < her_minScreenMove)
        {
            if (!ImageFade.IsInProgress(uiImage) && color.a > 0f)
            {
                ImageFade.Start(uiImage, 1f, 0f, move < her_minScreenMove ? her_minFadeoutTime : her_maxFadeoutTime);
            }
        }
        else if (!her_lineTriggered)
        {
            ImageFade.Stop(uiImage);

            color.a       = Mathf.Clamp(color.a + move * her_alphaFactor, 0f, 1f);
            uiImage.color = color;

            if (!her_sfxMatchStrike.isPlaying)
            {
                her_sfxMatchStrike.clip = her_sfxMatchStrikeSounds[Random.Range(0, her_sfxMatchStrikeSounds.Length)];
                her_sfxMatchStrike.Play();
            }
        }

        // Show another line
        if (!her_lineTriggered && color.a >= her_alphaLineTriggerUp)
        {
            StoryOutput output = null;
            while (her_outputIndex < story.Output.Count && !(output is LineBreak))
            {
                output = story.Output[her_outputIndex];
                if (output is StoryText)
                {
                    var line = (StoryText)output;
                    uiTextPlayer.DisplayOutput(line);
                }
                else if (output is StoryLink && output.Name == "continue")
                {
                    her_done = true;
                    StartCoroutine(her_alarm(output as StoryLink));
                    break;
                }
                her_outputIndex++;
            }

            // Show the closing line break, if any
            if (output != null)
            {
                uiTextPlayer.DisplayOutput(output);
            }

            // Play the match light sound
            if (!her_done)
            {
                her_sfxMatchLight.Play();
                her_cursorFlame.SetTrigger("light");
            }

            her_lineTriggered = true;
        }
        else if (her_lineTriggered && color.a <= her_alphaLineTriggerDown)
        {
            her_lineTriggered = false;
        }

        her_lastMousePos = Input.mousePosition;
    }
예제 #27
0
    IEnumerator snooze_Enter()
    {
        // Fade out alarm
        const float fadeOutTime = 0.1f;

        for (float fade = 0; fade <= fadeOutTime; fade += Time.deltaTime)
        {
            alarm_sfx.volume = Mathf.Lerp(alarm_sfxVolume, 0f, fade / fadeOutTime);
            yield return(null);
        }

        alarm_sfx.Stop();

        yield return(new WaitForSeconds(2f));

        CursorSet(snooze_cursor, snooze_fadeIn);

        snooze_sfxNoise.volume      = 0f;
        snooze_sfxUnderwater.volume = 0f;
        snooze_sfxNoise.Play();
        snooze_sfxUnderwater.Play();

        snooze_imgAnxietyEye.gameObject.SetActive(true);
        snooze_imgAnxietyHalo.gameObject.SetActive(true);
        snooze_imgDreamEye.gameObject.SetActive(true);
        snooze_imgDreamHalo.gameObject.SetActive(true);

        Color colorAnxiety = new Color(1f, 1f, 1f, 0f);
        Color colorDream   = new Color(1f, 1f, 1f, 0f);

        snooze_imgAnxietyEye.color  = colorAnxiety;
        snooze_imgAnxietyHalo.color = colorAnxiety;
        snooze_imgDreamEye.color    = colorDream;
        snooze_imgDreamHalo.color   = colorDream;

        var cameraNoise = Camera.main.GetComponent <NoiseAndScratches>();

        cameraNoise.grainIntensityMin = 0f;
        cameraNoise.grainIntensityMax = 0f;
        cameraNoise.enabled           = true;

        Animator cursorAnimator = cursor.GetComponentInChildren <Animator>();

        float t = 0;

        while (true)
        {
            yield return(null);

            t += Time.deltaTime;
            Vector2 mousePos = Input.mousePosition;

            float fadeIn   = Mathf.Clamp(t / snooze_fadeIn, 0f, 1f);
            float anxiety  = snooze_yCurve.Evaluate(mousePos.y / Screen.height);
            float dreaming = 1f - anxiety;
            float boost    = snooze_xCurve.Evaluate(mousePos.x / Screen.width);

            snooze_sfxNoise.volume      = anxiety * boost * fadeIn;
            snooze_sfxUnderwater.volume = dreaming * boost * fadeIn;

            cameraNoise.grainIntensityMin = snooze_noiseIntensity * fadeIn;
            cameraNoise.grainIntensityMax = snooze_noiseIntensity * fadeIn;

            cursorAnimator.SetInteger("snooze",
                                      boost <snooze_herTrigger ? 0 :
                                             anxiety> dreaming ? 1 :
                                      -1
                                      );

            colorAnxiety.a              = anxiety * boost * fadeIn;
            colorDream.a                = dreaming * boost * fadeIn;
            snooze_imgAnxietyEye.color  = colorAnxiety;
            snooze_imgAnxietyHalo.color = colorAnxiety;
            snooze_imgDreamEye.color    = colorDream;
            snooze_imgDreamHalo.color   = colorDream;

            if (story.State == StoryState.Idle && fadeIn > 0.5f && Clicked)
            {
                yield return(null);

                const float imgFadeOutTime = 0.3f;
                ImageFade.Start(snooze_imgDreamEye, 1f, 0f, imgFadeOutTime);
                ImageFade.Start(snooze_imgDreamHalo, 1f, 0f, imgFadeOutTime);
                ImageFade.Start(snooze_imgAnxietyEye, 1f, 0f, imgFadeOutTime);
                ImageFade.Start(snooze_imgAnxietyHalo, 1f, 0f, imgFadeOutTime);

                CursorHide(snooze_fadeOut);


                if (boost < snooze_herTrigger)
                {
                    story.DoLink("her");
                    StartCoroutine(SnoozeFadeOut(snooze_fadeOut));
                }
                else if (anxiety > dreaming)
                {
                    if (mousePos.x < Screen.width / 2)
                    {
                        story.DoLink("relationship");
                    }
                    else
                    {
                        story.DoLink("work");
                    }
                }
                else
                {
                    if (mousePos.x < Screen.width / 2)
                    {
                        story.DoLink("street");
                    }
                    else
                    {
                        story.DoLink("sea");
                    }
                }

                yield break;
            }
        }
    }
예제 #28
0
    IEnumerator snooze_Enter()
    {
        // Fade out alarm
        const float fadeOutTime = 0.1f;

        for (float fade = 0; fade <= fadeOutTime; fade += Time.deltaTime)
        {
            alarm_sfx.volume = Mathf.Lerp(alarm_sfxVolume, 0f, fade / fadeOutTime);
            yield return(null);
        }

        alarm_sfx.Stop();

        yield return(new WaitForSeconds(2f));

        snooze_sfxNoise.volume      = 0f;
        snooze_sfxUnderwater.volume = 0f;
        snooze_sfxNoise.Play();
        snooze_sfxUnderwater.Play();

        snooze_imgAnxietyEye.gameObject.SetActive(true);
        snooze_imgAnxietyHalo.gameObject.SetActive(true);
        snooze_imgDreamEye.gameObject.SetActive(true);
        snooze_imgDreamHalo.gameObject.SetActive(true);

        Color colorAnxiety = new Color(1f, 1f, 1f, 0f);
        Color colorDream   = new Color(1f, 1f, 1f, 0f);

        snooze_imgAnxietyEye.color  = colorAnxiety;
        snooze_imgAnxietyHalo.color = colorAnxiety;
        snooze_imgDreamEye.color    = colorDream;
        snooze_imgDreamHalo.color   = colorDream;

        float t = 0;

        while (true)
        {
            yield return(null);

            t += Time.deltaTime;

            float fadeIn   = Mathf.Clamp(t / snooze_fadeIn, 0f, 1f);
            float anxiety  = snooze_yCurve.Evaluate(Input.mousePosition.y / Screen.height);
            float dreaming = 1f - anxiety;
            float boost    = snooze_xCurve.Evaluate(Input.mousePosition.x / Screen.width);

            snooze_sfxNoise.volume      = anxiety * boost * fadeIn;
            snooze_sfxUnderwater.volume = dreaming * boost * fadeIn;

            colorAnxiety.a              = anxiety * boost * fadeIn;
            colorDream.a                = dreaming * boost * fadeIn;
            snooze_imgAnxietyEye.color  = colorAnxiety;
            snooze_imgAnxietyHalo.color = colorAnxiety;
            snooze_imgDreamEye.color    = colorDream;
            snooze_imgDreamHalo.color   = colorDream;

            if (story.State == TwineStoryState.Idle && fadeIn == 1f && uiTextPlayer.WasClicked())
            {
                yield return(null);

                const float imgFadeOutTime = 0.3f;
                ImageFade.Start(snooze_imgDreamEye, 1f, 0f, imgFadeOutTime);
                ImageFade.Start(snooze_imgDreamHalo, 1f, 0f, imgFadeOutTime);
                ImageFade.Start(snooze_imgAnxietyEye, 1f, 0f, imgFadeOutTime);
                ImageFade.Start(snooze_imgAnxietyHalo, 1f, 0f, imgFadeOutTime);

                const float herTrigger = 0.3f;
                if (boost < herTrigger)
                {
                    story.Advance("her");
                    StartCoroutine(SnoozeFadeOut(snooze_fadeOut));
                }
                else if (anxiety > dreaming)
                {
                    story.Advance("anxiety");
                }
                else
                {
                    story.Advance("dream");
                }

                yield break;
            }
        }
    }
예제 #29
0
 void sea_Enter()
 {
     uiImage.sprite = sea_image;
     ImageFade.Start(uiImage, 0f, 1f, 8f);
     StartCoroutine(SnoozeFadeOut(2f, noise: 0f, underwater: 1f));
 }
예제 #30
0
 void sea_Exit()
 {
     ImageFade.Start(uiImage, 1f, 0f, 0f);
 }
예제 #31
0
    IEnumerator LoadEditor()
    {
        // Fade
        yield return(fader.fadeOut(1.0f));

        // Assign to the custom database
        customSkin.break0 = GetAudioClipFromLoadedResources("break-0", resourcesDictionary);

        int              bgCount  = 0;
        Texture2D        tex      = null;
        List <Texture2D> textures = new List <Texture2D>();

        while (true)
        {
            tex = GetTextureFromLoadedResources("background-" + bgCount++, resourcesDictionary);

            if (!tex)
            {
                break;
            }
            textures.Add(tex);
        }
        customSkin.backgrounds = textures.ToArray();

        customSkin.clap      = GetAudioClipFromLoadedResources("clap", resourcesDictionary);
        customSkin.fretboard = GetTextureFromLoadedResources("fretboard-0", resourcesDictionary);
        customSkin.metronome = GetAudioClipFromLoadedResources("metronome", resourcesDictionary);

        // STANDARD NOTES
        for (int i = 0; i < customSkin.reg_strum.Length; ++i)
        {
            customSkin.reg_strum[i] = GetTextureFromLoadedResources(i + "_reg_strum", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.reg_hopo.Length; ++i)
        {
            customSkin.reg_hopo[i] = GetTextureFromLoadedResources(i + "_reg_hopo", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.reg_tap.Length; ++i)
        {
            customSkin.reg_tap[i] = GetTextureFromLoadedResources(i + "_reg_tap", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.sp_strum.Length; ++i)
        {
            customSkin.sp_strum[i] = GetTextureFromLoadedResources(i + "_sp_strum", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.sp_hopo.Length; ++i)
        {
            customSkin.sp_hopo[i] = GetTextureFromLoadedResources(i + "_sp_hopo", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.sp_tap.Length; ++i)
        {
            customSkin.sp_tap[i] = GetTextureFromLoadedResources(i + "_sp_tap", resourcesDictionary);
        }

        // STANDARD FRETS
        for (int i = 0; i < customSkin.fret_base.Length; ++i)
        {
            customSkin.fret_base[i] = GetTextureFromLoadedResources(i + "_fret_base", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_cover.Length; ++i)
        {
            customSkin.fret_cover[i] = GetTextureFromLoadedResources(i + "_fret_cover", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_press.Length; ++i)
        {
            customSkin.fret_press[i] = GetTextureFromLoadedResources(i + "_fret_press", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_release.Length; ++i)
        {
            customSkin.fret_release[i] = GetTextureFromLoadedResources(i + "_fret_release", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_anim.Length; ++i)
        {
            customSkin.fret_anim[i] = GetTextureFromLoadedResources(i + "_fret_anim", resourcesDictionary);
        }

        // DRUMS
        for (int i = 0; i < customSkin.fret_base.Length; ++i)
        {
            customSkin.drum_fret_base[i] = GetTextureFromLoadedResources(i + "_drum_fret_base", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_cover.Length; ++i)
        {
            customSkin.drum_fret_cover[i] = GetTextureFromLoadedResources(i + "_drum_fret_cover", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_press.Length; ++i)
        {
            customSkin.drum_fret_press[i] = GetTextureFromLoadedResources(i + "_drum_fret_press", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_release.Length; ++i)
        {
            customSkin.drum_fret_release[i] = GetTextureFromLoadedResources(i + "_drum_fret_release", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_anim.Length; ++i)
        {
            customSkin.drum_fret_anim[i] = GetTextureFromLoadedResources(i + "_drum_fret_anim", resourcesDictionary);
        }

        // GHL LOADING
        for (int i = 0; i < customSkin.reg_strum_ghl.Length; ++i)
        {
            customSkin.reg_strum_ghl[i] = GetTextureFromLoadedResources(i + "_reg_strum_ghl", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.reg_hopo_ghl.Length; ++i)
        {
            customSkin.reg_hopo_ghl[i] = GetTextureFromLoadedResources(i + "_reg_hopo_ghl", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.reg_tap_ghl.Length; ++i)
        {
            customSkin.reg_tap_ghl[i] = GetTextureFromLoadedResources(i + "_reg_tap_ghl", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.sp_strum_ghl.Length; ++i)
        {
            customSkin.sp_strum_ghl[i] = GetTextureFromLoadedResources(i + "_sp_strum_ghl", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.sp_hopo_ghl.Length; ++i)
        {
            customSkin.sp_hopo_ghl[i] = GetTextureFromLoadedResources(i + "_sp_hopo_ghl", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.sp_tap_ghl.Length; ++i)
        {
            customSkin.sp_tap_ghl[i] = GetTextureFromLoadedResources(i + "_sp_tap_ghl", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_base_ghl.Length; ++i)
        {
            customSkin.fret_base_ghl[i] = GetTextureFromLoadedResources(i + "_fret_base_ghl", resourcesDictionary);
        }

        for (int i = 0; i < customSkin.fret_press_ghl.Length; ++i)
        {
            customSkin.fret_press_ghl[i] = GetTextureFromLoadedResources(i + "_fret_press_ghl", resourcesDictionary);
        }

        customSkin.fret_stem  = GetTextureFromLoadedResources("fret_stem", resourcesDictionary);
        customSkin.hit_flames = GetTextureFromLoadedResources("hit_flames", resourcesDictionary);

        // Load editor
        int buildIndex = UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex;

        enabled = false;
        fader   = null;
        UnityEngine.SceneManagement.SceneManager.LoadScene(buildIndex + 1);
    }
예제 #32
0
 void street3_Exit()
 {
     ImageFade.Start(uiImage, 1f, 0f, 0.1f);
     uiTextPlayer.AutoDisplay = true;
 }