示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (this.obstacle.IsDone)
     {
         rend.material.color = Color.green;
     }
     else if (this.obstacle.IsNextObstacle)
     {
         float distance = obstacle.rightCameraPerspective();
         this.correctness = remap(distance, minThreshold, maxThreshold, 0, 1);
         if (this.correctness >= 0.5)
         {
             rend.material.color = Color.Lerp(Color.yellow, Color.green, this.colorLerpCurve.Evaluate((correctness - 0.5f) * 2));
         }
         else if (this.correctness > 0)
         {
             rend.material.color = Color.Lerp(Color.red, Color.yellow, correctness * 2);
         }
         else
         {
             rend.material.color = Color.white;
         }
     }
 }