Пример #1
0
 private static void RanchCreature(Instance smi)
 {
     Debug.Assert(smi.ranchStation != null, "smi.ranchStation was null");
     RanchableMonitor.Instance targetRanchable = smi.ranchStation.targetRanchable;
     if (!targetRanchable.IsNullOrStopped())
     {
         KPrefabID component = targetRanchable.GetComponent <KPrefabID>();
         smi.sm.rancher.Get(smi).Trigger(937885943, component.PrefabTag.Name);
         smi.ranchStation.RanchCreature();
     }
 }
Пример #2
0
        public void FindRanchable()
        {
            int        targetRanchCell = GetTargetRanchCell();
            CavityInfo cavityForCell   = Game.Instance.roomProber.GetCavityForCell(targetRanchCell);

            if (cavityForCell == null || cavityForCell.room == null || cavityForCell.room.roomType != Db.Get().RoomTypes.CreaturePen)
            {
                TriggerRanchStationNoLongerAvailable();
            }
            else
            {
                if (this.targetRanchable != null && !CanRanchableBeRanchedAtRanchStation(this.targetRanchable, this, cavityForCell, targetRanchCell))
                {
                    TriggerRanchStationNoLongerAvailable();
                }
                if (this.targetRanchable.IsNullOrStopped())
                {
                    CavityInfo cavityForCell2 = Game.Instance.roomProber.GetCavityForCell(targetRanchCell);
                    RanchableMonitor.Instance targetRanchable = null;
                    if (cavityForCell2 != null && cavityForCell2.creatures != null)
                    {
                        foreach (KPrefabID creature in cavityForCell2.creatures)
                        {
                            if (!((UnityEngine.Object)creature == (UnityEngine.Object)null))
                            {
                                RanchableMonitor.Instance sMI = creature.GetSMI <RanchableMonitor.Instance>();
                                if (!sMI.IsNullOrStopped() && CanRanchableBeRanchedAtRanchStation(sMI, this, cavityForCell2, targetRanchCell))
                                {
                                    targetRanchable = sMI;
                                    break;
                                }
                            }
                        }
                    }
                    this.targetRanchable = targetRanchable;
                    if (!this.targetRanchable.IsNullOrStopped())
                    {
                        this.targetRanchable.targetRanchStation = this;
                    }
                }
            }
        }