Esempio n. 1
0
 // Player collisions with sides, obstacles, crates etc
 private void OnCollisionEnter(Collision collision)
 {
     // If collided with obstacle
     if (collision.gameObject.tag == "Obstacle")
     {
         // Sink the player
         Vector3 sink = new Vector3(0, -0.01f, 0);
         transform.position += sink;
     }
     // If collided with crate
     else if (collision.gameObject.tag == "Crate")
     {
         // Destroy it
         Debug.Log("Picked up crate");
         Destroy(collision.gameObject);
         // Get some points
         statMgr.CrateScored();
     }
 }