Rugbug_Redfern

RedlabsUIEffect_Color.cs

Sep 19th, 2020 (edited)
774
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using DG.Tweening;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4.  
  5. [ExecuteAlways]
  6. public class RedlabsUIEffect_Color : RedlabsUIEffect_Base
  7. {
  8.     [SerializeField] Graphic graphic;
  9.     [SerializeField] Color activateColor = Color.white;
  10.     [SerializeField] Color deactivateColor = Color.white;
  11.  
  12.     void Awake()
  13.     {
  14.         if(!graphic)
  15.         {
  16.             graphic = GetComponent<Graphic>();
  17.             deactivateColor = graphic.color;
  18.         }
  19.     }
  20.  
  21.     public override void OnActivate()
  22.     {
  23.         graphic.DOColor(activateColor, 0.3f);
  24.     }
  25.  
  26.     public override void OnDeactivate()
  27.     {
  28.         graphic.DOColor(deactivateColor, 0.3f);
  29.     }
  30. }
  31.  
Add Comment
Please, Sign In to add comment