/// <summary> /// For Design-time only /// </summary> public LivingObject() : this(null, new ObjectID(ObjectType.Living, 1234)) { var props = new KeyValuePair<PropertyID, object>[] { new KeyValuePair<PropertyID, object>(PropertyID.Name, "Testname"), new KeyValuePair<PropertyID, object>(PropertyID.Gender, LivingGender.Male), new KeyValuePair<PropertyID, object>(PropertyID.MaterialID, MaterialID.Flesh), }; var data = new LivingData() { ObjectID = new ObjectID(ObjectType.Living, 1234), LivingID = Dwarrowdelf.LivingID.Dwarf, CreationTick = 123, CreationTime = DateTime.Now, Properties = props, }; ReceiveObjectData(data); var item = new ItemObject(); item.MoveTo(this, new IntVector3()); ReceiveObjectDataEnd(); }
public BuildItemManager(ItemObject workbench) { this.Workbench = workbench; m_buildOrderQueue = new ObservableCollection<BuildOrder>(); Init(); }
public StoreToStockpileJob(IJobObserver parent, Stockpile stockpile, ItemObject item) : base(parent) { this.Item = item; m_stockpile = stockpile; m_state = State.MoveToItem; }
/// <summary> /// For Design-time only /// </summary> public LivingObject() : this(null, new ObjectID(ObjectType.Living, 1234)) { var r = new Random(); var props = new Tuple<PropertyID, object>[] { new Tuple<PropertyID, object>(PropertyID.Name, "Testname"), new Tuple<PropertyID, object>(PropertyID.Gender, LivingGender.Male), new Tuple<PropertyID, object>(PropertyID.MaterialID, MaterialID.Flesh), }; var data = new LivingData() { ObjectID = new ObjectID(ObjectType.Living, (uint)r.Next(5000)), LivingID = Dwarrowdelf.LivingID.Dwarf, CreationTick = r.Next(), CreationTime = DateTime.Now, Properties = props, }; ReceiveObjectData(data); var item = new ItemObject(); item.MoveTo(this, new IntPoint3()); ReceiveObjectDataEnd(); }
public void AddUninstallJob(ItemObject item) { var data = new InstallJobData() { Mode = InstallMode.Uninstall, Item = item, }; item.ReservedBy = this; m_jobDataList.Add(data); }
public void AddInstallJob(ItemObject item, IntPoint3 location) { var data = new InstallJobData() { Mode = InstallMode.Install, Item = item, Location = location, }; item.ReservedBy = this; m_jobDataList.Add(data); m_environment.OnTileExtraChanged(location); }
void OnArmorIsWornChanged(ItemObject wearable, bool isWorn) { Debug.Assert(wearable.Container == this); var slot = wearable.ArmorInfo.Slot; if (isWorn) { Debug.Assert(m_armorSlots.All(t => t.Item1 != slot)); m_armorSlots.Add(new Tuple <ArmorSlot, ItemObject>(slot, wearable)); } else { int idx = -1; for (int i = 0; i < m_armorSlots.Count; ++i) { if (m_armorSlots[i].Item1 == slot) { idx = i; break; } } if (idx == -1) { throw new Exception(); } Debug.Assert(m_armorSlots[idx].Item2 == wearable); m_armorSlots.RemoveAt(idx); } RecalcArmorClass(); }
bool Match(ItemObject item) { var c = this.Criteria; if (c == null) return false; return c.Match(item); }
void ItemObject_ParameterChanged(ItemObject ob) { m_itemTracker.Update(ob); }
public bool LocationOk(IntVector3 p, ItemObject ob) { if (!this.Area.Contains(p)) throw new Exception(); return GetStack(p) == GetMinStack(); }
void OnWeaponIsWieldedChanged(ItemObject weapon, bool isWielded) { Debug.Assert(weapon.Parent == this); if (isWielded) { this.Weapon = weapon; Notify("Weapon"); } else { this.Weapon = null; Notify("Weapon"); } }
void OnArmorIsWornChanged(ItemObject wearable, bool isWorn) { Debug.Assert(wearable.Parent == this); var slot = wearable.ArmorInfo.Slot; if (isWorn) { Debug.Assert(m_armorSlots.All(t => t.Item1 != slot)); m_armorSlots.Add(new Tuple<ArmorSlot, ItemObject>(slot, wearable)); } else { int idx = -1; for (int i = 0; i < m_armorSlots.Count; ++i) { if (m_armorSlots[i].Item1 == slot) { idx = i; break; } } if (idx == -1) throw new Exception(); Debug.Assert(m_armorSlots[idx].Item2 == wearable); m_armorSlots.RemoveAt(idx); } RecalcArmorClass(); }
internal void OnItemIsEquippedChanged(ItemObject item, bool isEquipped) { if (item.IsArmor) OnArmorIsWornChanged(item, isEquipped); else if (item.IsWeapon) OnWeaponIsWieldedChanged(item, isEquipped); else throw new Exception(); }
void OnIsInstalledChanged(ItemObject ob) { if (ob != this.Workbench) return; Cleanup(); }
public static BuildItemManager FindOrCreateBuildItemManager(ItemObject workbench) { var mgr = s_buildItemManagers.FirstOrDefault(m => m.Workbench == workbench); if (mgr == null) { mgr = new BuildItemManager(workbench); s_buildItemManagers.Add(mgr); } return mgr; }
public static BuildItemManager FindBuildItemManager(ItemObject workbench) { return s_buildItemManagers.FirstOrDefault(m => m.Workbench == workbench); }