Example #1
0
 void OnTriggerExit2D(Collider2D coll)
 {
     if (coll.CompareTag("Player"))
     {
         CharacterSorter charSorter = coll.gameObject.GetComponent <CharacterSorter>();
         charSorter.depthOverride = 0f;
     }
 }
Example #2
0
        void OnTriggerStay2D(Collider2D coll)
        {
            if (coll.CompareTag("Player"))
            {
                CharacterMotor  motor      = coll.gameObject.GetComponent <CharacterMotor>();
                CharacterSorter charSorter = coll.gameObject.GetComponent <CharacterSorter>();

                if (!motor.onRoof)
                {
                    charSorter.depthOverride = _z + 0.15f;
                }
                else
                {
                    charSorter.depthOverride = 0f;
                }
            }
        }