Esempio n. 1
0
    private void Update()
    {
        switch (state)
        {
        case PaintingState.Disabled:
            break;

        case PaintingState.FadingToDisabled:
            if (fadingLerp <= 1)
            {
                fadingLerp += Time.deltaTime / FadingOutDuration;

                GetComponent <Renderer>().materials[0].Lerp(SuccessMaterial,
                                                            PaintingMaterial,
                                                            fadingLerp);
                GetComponent <Renderer>().materials[1].Lerp(SuccessMaterial,
                                                            FrameMaterial,
                                                            fadingLerp);
            }
            else
            {
                state = PaintingState.Disabled;
            }
            break;

        case PaintingState.Enabled:
            fadingLerp = Mathf.PingPong(Time.time, FadingInDuration) / FadingInDuration;
            GetComponent <Renderer>().materials[1].Lerp(LightMaterial,
                                                        FrameMaterial,
                                                        fadingLerp);
            break;

        case PaintingState.Winning:
            GetComponent <Renderer>().materials[0].Lerp(WinMaterial,
                                                        PaintingMaterial,
                                                        fadingLerp);
            GetComponent <Renderer>().materials[1].Lerp(WinMaterial,
                                                        FrameMaterial,
                                                        fadingLerp);
            fadingLerp += Time.deltaTime / FadingOutDuration;
            break;
        }
    }
Esempio n. 2
0
 public void Win()
 {
     state      = PaintingState.Winning;
     fadingLerp = 0;
 }
Esempio n. 3
0
 public void Disable()
 {
     state      = PaintingState.FadingToDisabled;
     fadingLerp = 0;
 }
Esempio n. 4
0
 public void Enable()
 {
     state = PaintingState.Enabled;
 }
Esempio n. 5
0
 private void Awake()
 {
     state             = PaintingState.Disabled;
     fadingLerp        = 0;
     gameManagerScript = GameManagerHolder.GetComponent <ArrowGameManager>();
 }
Esempio n. 6
0
 public static void GoPaintingState()
 {
     PaintingState?.Invoke();
 }