Exemple #1
0
 void OnTriggerExit(Collider c)
 {
     if (c == player)
     {
         door.Close();
     }
 }
Exemple #2
0
    private void OnCollisionExit(Collision other)
    {
        // Stop if the player doesn't have to hold the button
        if (!mustHold)
        {
            return;
        }

        // Stop when no locked object is defined
        if (!lockedObject)
        {
            return;
        }

        // Stop when no there is no rigidbody
        if (!other.gameObject.GetComponent <Rigidbody>())
        {
            return;
        }

        // Remove mass
        currentMass -= other.gameObject.GetComponent <Rigidbody>().mass;

        // Check mass difference
        if (currentMass < minimalMass)
        {
            //Debug.Log("Lock the door");
            door.Close();
        }
    }
Exemple #3
0
 public void Close()
 {
     foreach (Transform child in transform)
     {
         GameObject  childObject = child.gameObject;
         SlidingDoor childScript = childObject.GetComponent <SlidingDoor>();
         childScript.Close();
     }
 }