예제 #1
0
 void OnPhysicsCollisionExit(PhysicsCollider other)
 {
     if (other.CompareTag("Terrain"))
     {
         Debug.Log("Left planet");
         physics.attractionActive = true;
         onPlanet = null;
     }
 }
예제 #2
0
 void OnPhysicsCollisionEnter(PhysicsCollider other)
 {
     if (other.CompareTag("Terrain"))               //hit planet
     {
         if (onPlanet == null)
         {
             Debug.Log("Hit planet");
             physics.attractionActive = false;
             physics.Stop();
             onPlanet = other.GetComponent <Planet>();
         }
         else                     //squished between planets
                                  //TODO: kill player (probably a different script tho)
         {
         }
     }
 }