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; } }
public void Win() { state = PaintingState.Winning; fadingLerp = 0; }
public void Disable() { state = PaintingState.FadingToDisabled; fadingLerp = 0; }
public void Enable() { state = PaintingState.Enabled; }
private void Awake() { state = PaintingState.Disabled; fadingLerp = 0; gameManagerScript = GameManagerHolder.GetComponent <ArrowGameManager>(); }
public static void GoPaintingState() { PaintingState?.Invoke(); }