Beispiel #1
0
 public bool AttemptToHitch(RidableHorse horse, HitchSpot hitch = null)
 {
     if (horse == null)
     {
         return(false);
     }
     if (hitch == null)
     {
         hitch = GetClosest(horse.transform.position);
     }
     if (hitch != null)
     {
         object obj = Interface.CallHook("OnHorseHitch", horse, hitch);
         if (obj is bool)
         {
             return((bool)obj);
         }
         hitch.SetOccupiedBy(horse);
         horse.SetHitch(this);
         horse.transform.SetPositionAndRotation(hitch.spot.position, hitch.spot.rotation);
         horse.DismountAllPlayers();
         return(true);
     }
     return(false);
 }
Beispiel #2
0
 public void Unhitch(RidableHorse horse)
 {
     HitchSpot[] array = hitchSpots;
     foreach (HitchSpot hitchSpot in array)
     {
         if (hitchSpot.GetHorse(base.isServer) == horse)
         {
             if (Interface.CallHook("OnHorseUnhitch", horse, hitchSpot) != null)
             {
                 break;
             }
             hitchSpot.SetOccupiedBy(null);
             horse.SetHitch(null);
         }
     }
 }