public void UnregisterAI(AI ai) { if (this.m_AllAIs.Contains(ai)) { this.m_AllAIs.Remove(ai); if (ai.IsHuman()) { this.m_AllHumanAIs.Add(ai); } else { this.m_AllAnimalAIs.Remove(ai); } } }
public void RegisterAI(AI new_ai) { if (!this.m_AllAIs.Contains(new_ai)) { this.m_AllAIs.Add(new_ai); this.UpdateActivity(true); if (new_ai.IsHuman()) { this.m_AllHumanAIs.Add(new_ai); } else { this.m_AllAnimalAIs.Add(new_ai); } } }
public void Harvest() { base.gameObject.ReplRequestOwnership(false); AIParams aiparams = AIManager.Get().m_AIParamsMap[(int)this.m_AIID]; foreach (GameObject gameObject in aiparams.m_HarvestingResult) { Item component = gameObject.GetComponent <Item>(); DebugUtils.Assert(component != null, "[DeadBody:OnExecute] Harvesting result list contains object without Item component - " + gameObject.name, true, DebugUtils.AssertType.Info); ItemID itemID = (ItemID)Enum.Parse(typeof(ItemID), component.m_InfoName); if (MainLevel.s_GameTime - this.m_StartTime >= aiparams.m_DeadBodyFoodSpoilTime) { ItemInfo info = ItemsManager.Get().GetInfo(itemID); if (info.IsFood()) { FoodInfo foodInfo = (FoodInfo)info; if (foodInfo.m_SpoilEffectID != ItemID.None) { itemID = foodInfo.m_SpoilEffectID; } } } for (int i = 0; i < Skill.Get <HarvestingAnimalsSkill>().GetItemsCountMul(); i++) { ItemsManager.Get().CreateItem(itemID, false, base.transform).Take(); } } if (this.m_AddHarvestingItem != ItemID.None) { ItemsManager.Get().CreateItem(this.m_AddHarvestingItem, false, base.transform).Take(); } Item[] componentsInChildren = base.transform.GetComponentsInChildren <Item>(); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].transform.parent = null; componentsInChildren[j].StaticPhxRequestRemove(); componentsInChildren[j].Take(); } this.OnHarvest(); UnityEngine.Object.Destroy(base.gameObject); if (!AI.IsHuman(this.m_AIID)) { Skill.Get <HarvestingAnimalsSkill>().OnSkillAction(); } }