コード例 #1
0
 protected virtual void InitTween(GameObject p_tweenTarget, float p_durantion, Color p_to)
 {
     if (!Started)
     {
         Start();
     }
             #if NGUI_DLL
     TweenColor.Begin(p_tweenTarget, p_durantion, p_to);
             #else
     ColorScheduler tc = tweenTarget.GetComponent <ColorScheduler>();
     if (tc == null)
     {
         tc = tweenTarget.gameObject.AddComponent <ColorScheduler>();
     }
     if (tc != null)
     {
         Renderer        ren     = tweenTarget.GetComponent <Renderer>();
         MaskableGraphic graphic = tweenTarget.GetComponent <MaskableGraphic>();
         tc.MaxTime = duration;
         tc.From    = ren != null? ren.material.color : (graphic != null? graphic.color : mColor);
         tc.To      = p_to;
         tc.StartTimer();
     }
             #endif
 }
コード例 #2
0
    protected override void OnDisable()
    {
        base.OnDisable();
        if (Started && tweenTarget != null)
        {
                        #if NGUI_DLL
            TweenColor tc = tweenTarget.GetComponent <TweenColor>();

            if (tc != null)
            {
                tc.color   = mColor;
                tc.enabled = false;
            }
                        #else
            ColorScheduler tc = tweenTarget.GetComponent <ColorScheduler>();

            if (tc != null)
            {
                tc.From    = mColor;
                tc.enabled = false;
            }
                        #endif
        }
    }