예제 #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.ToString() == "Simulator Car (UnityEngine.BoxCollider)")
     {
         if (stopLight != null)
         {
             if (stopLight.getCurrentLight() == "RED")
             {
                 Debug.Log("Failed stop light!");
                 scoreCard.UnsuccessfulLightSequence();
                 lightQueue.trafficLight = true;
                 this.gameObject.SetActive(false);
                 passTrigger.SetActive(false);
             }
         }
         else
         {
             Debug.Log("Stop test failed!");
             scoreCard.UnsuccessfulStop();
             if (lightQueue != null)
             {
                 lightQueue.trafficLight = true;
             }
             this.gameObject.SetActive(false);
             if (passTrigger != null)
             {
                 passTrigger.SetActive(false);
             }
         }
     }
 }
예제 #2
0
 private void OnTriggerStay(Collider other)
 {
     if (other.ToString() == "Simulator Car (UnityEngine.BoxCollider)")
     {
         if (stopLight != null)
         {
             if (stopLight.getCurrentLight() == "RED")
             {
                 if (Math.Round(carController.CurrentSpeed) == 0)
                 {
                     if (!successfulStop)
                     {
                         scoreCard.SuccessfulStop();
                         successfulStop = true;
                         Debug.Log("Successful Stop at Light!");
                     }
                     //this.gameObject.SetActive(false);
                     // if (failTrigger != null)
                     // {
                     //failTrigger.SetActive(false);
                     //}
                 } /*else
                    * {
                    * Debug.Log("Failure to stop at red light!");
                    * this.gameObject.SetActive(false);
                    * if (failTrigger != null)
                    * {
                    *    failTrigger.SetActive(false);
                    * }
                    * }*/
             }
         }
         else
         {
             if (Math.Round(carController.CurrentSpeed) == 0)
             {
                 Debug.Log("Successful Stop!");
                 scoreCard.SuccessfulStop();
                 this.gameObject.SetActive(false);
                 failTrigger.SetActive(false);
             }
         }
     }
 }