示例#1
0
 /// <summary>
 /// If the light is on, chase the light
 /// </summary>
 void ChaseIfLightOn()
 {
     if (LightOn() && chasing != Chasing.PLAYER)
     {
         chasing                 = Chasing.LIGHT;
         agent.isStopped         = false;
         myRigidbody.constraints = RigidbodyConstraints.None;
         animationController.Run();
         Vector3 newGoal = FirstPersonController.instance.GetLightLocation();
         if (newGoal != new Vector3(0, 0, 0))
         {
             NavMeshHit hit;
             NavMesh.SamplePosition(newGoal, out hit, 10, 1);
             agent.destination = hit.position;
         }
     }
 }