void OnTriggerEnter()
 {
     if (InSceneLevelSwitcher.Get())
     {
         InSceneLevelSwitcher.Get().SetIndex(m_Index);
     }
 }
Exemple #2
0
 public static InSceneLevelSwitcher Get()
 {
     if (g_InSceneLevelSwitcher == null)
     {
         g_InSceneLevelSwitcher = FindObjectOfType <InSceneLevelSwitcher> ();
         if (g_InSceneLevelSwitcher == null)
         {
             return(null);
         }
     }
     return(g_InSceneLevelSwitcher);
 }
    void OnTriggerEnter(Collider a_Collider)
    {
        ControlledCapsuleCollider controlledCapsuleCollider = a_Collider.GetComponent <ControlledCapsuleCollider>();

        if (controlledCapsuleCollider != null)
        {
            //Prevent death state to be used if the collider is no-clipping
            if (controlledCapsuleCollider.AreCollisionsActive())
            {
                Debug.Log("Death triggered by: " + transform.name);
                if (InSceneLevelSwitcher.Get())
                {
                    InSceneLevelSwitcher.Get().Respawn();
                }
            }
        }
    }