Пример #1
0
        void OnTriggerEnter(Collider other)
        {
            if (LastCheckPoint == this)
            {
                return;                         //Means the animal has already enter this CheckPoint
            }
            var animal = other.GetComponentInParent <MAnimal>();

            if (!animal)
            {
                return;                 //Skip if there's no Animal
            }
            if (animal != MAnimal.MainAnimal)
            {
                return;                                                    //Skip if there's no the Player Animal
            }
            MRespawner.instance.transform.position = transform.position;   //Set on the Respawner to this Position
            MRespawner.instance.transform.rotation = transform.rotation;   //Set on the Respawner to this Position
            MRespawner.instance.RespawnState       = animal.ActiveStateID; //Set on the Respawner the Last Animal State

            if (LastCheckPoint)
            {
                LastCheckPoint.OnActive.Invoke();
            }

            LastCheckPoint = this;                                  //Check that the last check Point of entering was this one
            OnEnter.Invoke();
            Collider.enabled = false;
        }
Пример #2
0
 public static void ResetCheckPoint()
 {
     if (LastCheckPoint)
     {
         LastCheckPoint.Collider.enabled = true;
         LastCheckPoint.OnActive.Invoke();
         LastCheckPoint = null;
     }
 }