예제 #1
0
 public virtual void FadeOut()
 {
     this.timer = this.timer + 0.05f;
     this.line.SetColor(MathS.ColorLerp(this.initialColor, Color.black, this.timer));
     if (this.timer > 1f)
     {
         this.DestroySelf();
     }
 }
예제 #2
0
 // Update is called once per frame
 void Update()
 {
     if (transform.position.z > 200)
     {
         //blank out title when banner is inverted
         if (transform.eulerAngles.x < 180)
         {
             line.color = colorNormal;
         }
         else
         {
             line.SetColor(Color.clear, 0, 30);
         }
         //translate title banner through world space towards the player at 1 meter per second * 240
         transform.Translate(Vector3.back * Time.deltaTime * 240, Space.World);
         //rotate title banner around its local X axis at 1 degreee per second * 240
         transform.Rotate(Vector3.left * Time.deltaTime * 360);
         //set color lerp start time
         starttime = Time.time;
     }
     else
     {
         //lerp color
         //var myLerp = Mathf.Lerp(0, 1, (Time.time - starttime) / duration);
         //var c = Color.Lerp(color1, color2, myLerp);
         var c = (MathS.ColorLerp(color1, color2, (Time.time - starttime) / duration));
         line.color = c;
         //invert colors
         if (c == color2)
         {
             if (toggle)
             {
                 toggle = !toggle;
                 color1 = colorNormal;
                 color2 = colorIntense;
             }
             else
             {
                 toggle = !toggle;
                 color1 = colorIntense;
                 color2 = colorNormal;
             }
             starttime = Time.time;
         }
     }
 }