Example #1
0
 void Update()
 {
     if (fadeIn == fadeState.FadingIn)
     {
         if (fader.color.a < 1.0)
         {
             Color currColour = fader.color;
             currColour.a += fadeSpeed;
             fader.color = currColour;
         }
         else
         {
             fadeIn = fadeState.Idle;
         }
     }
     else if (fadeIn == fadeState.Idle)
     {
         if (timer < 0)
         {
             fadeIn = fadeState.FadingOut;
         }
         else
         {
             timer -= 0.05f;
         }
     }
     else
     {
         {
             if (fader.color.a > 0)
             {
                 Color currColour = fader.color;
                 currColour.a -= fadeSpeed;
                 fader.color = currColour;
             }
             else
             {
                 if (startDialogue)
                 {
                     GameObject.Find("Canvas").GetComponent<NodeManager>().enabled = true;
                     enabled = false;
                 }
                 else
                 {
                     GameObject.Find("MoreText").GetComponent<TextFade>().enabled = true;
                     enabled = false;
                 }
             }
         }
     }
 }
Example #2
0
        // Update is called once per frame
        void FixedUpdate()
        {
            switch (fader)
            {
            case fadeState.Solid:
                if (isClicked)
                {
                    Vector3 mouseTemp = Input.mousePosition;
                    mouseTemp.z        = 1;
                    transform.position = Vector3.MoveTowards(transform.position, Camera.main.ScreenToWorldPoint(mouseTemp), speed);
                    if (!GameManager.Instance.isEditing)
                    {
                        isClicked = false;
                        StateChange();
                    }
                }
                break;

            case fadeState.Faded:

                break;

            case fadeState.FadingIn:
                face.color = new Color(1, 1, 1, Mathf.MoveTowards(face.color.a, 1, 0.2f * Time.deltaTime));
                if (face.color.a >= 1)
                {
                    fader = fadeState.Solid;
                    StateChange();
                    body.enabled = true;
                }
                break;

            case fadeState.FadingOut:
                face.color = new Color(1, 1, 1, Mathf.MoveTowards(face.color.a, 0.1f, 0.4f * Time.deltaTime));
                if (face.color.a <= 0.1f)
                {
                    fader = fadeState.Faded;
                    StateChange();
                    body.enabled = false;
                }
                break;
            }
        }
Example #3
0
    void RunFade()
    {
        switch (currentFadeState)
        {
        case fadeState.fadeState_fadein:
        {
            if (fadeTime > 2.0f)
            {
                whitebg.color    = new Color(1, 1, 1, fadeTime / 2.0f);
                currentFadeState = fadeState.fadeState_white;
                fadeTime         = 0.0f;
            }
        }
        break;

        case fadeState.fadeState_white:
        {
            if (fadeTime > 5.0f)
            {
                whitebg.color    = new Color(1, 1, 1, 1.0f);
                currentFadeState = fadeState.fadeState_fadeout;
                fadeTime         = 0.0f;
            }
        }
        break;

        case fadeState.fadeState_fadeout:
        {
            if (fadeTime > 2.0f)
            {
                whitebg.color    = new Color(1, 1, 1, 0.0f);
                currentFadeState = fadeState.fadeState_noeffect;
                fadeTime         = 0.0f;
            }
        }
        break;
        }
    }
Example #4
0
 public void FadeIn()
 {
     fader = fadeState.FadingIn;
 }
Example #5
0
 public void Fade()
 {
     fader = fadeState.FadingOut;
 }