public void SetUnitUpgradeLevel(Combat_Item cd, int level) { switch (cd.GetCombatItemType()) { case 2: { int index = GetDataIndex(this.Heroes_Upgrades, cd); if (index != -1) { this.Heroes_Upgrades[index].Count = level; } else { Slot ds = new Slot(cd.GetGlobalID(), level); this.Heroes_Upgrades.Add(ds); } break; } case 1: { int index = GetDataIndex(this.Spell_Upgrades, cd); if (index != -1) { this.Spell_Upgrades[index].Count = level; } else { Slot ds = new Slot(cd.GetGlobalID(), level); this.Spell_Upgrades.Add(ds); } break; } default: { int index = GetDataIndex(this.Unit_Upgrades, cd); if (index != -1) { this.Unit_Upgrades[index].Count = level; } else { Slot ds = new Slot(cd.GetGlobalID(), level); this.Unit_Upgrades.Add(ds); } break; } } }
internal override void Process() { if (this.Device.State == State.IN_BATTLE) { List <Slot> _PlayerUnits = this.Device.Player.Avatar.Units; Slot _DataSlot = _PlayerUnits.Find(t => t.Data == Unit.GetGlobalID()); if (_DataSlot != null) { _DataSlot.Count -= 1; } } /* List<Component> components = level.GetComponentManager().GetComponents(0); * for (int i = 0; i < components.Count; i++) * { * UnitStorageComponent c = (UnitStorageComponent)components[i]; * if (c.GetUnitTypeIndex(Unit) != -1) * { * var storageCount = c.GetUnitCountByData(Unit); * if (storageCount >= 1) * { * c.RemoveUnits(Unit, 1); * break; * } * } * }*/ }
internal void Set_Unit_Count_V2(Combat_Item cd, int count) { var index = GetDataIndex(this.Units2, cd); if (index != -1) { this.Units2[index].Count = count; } else { var ds = new Slot(cd.GetGlobalID(), count); this.Units2.Add(ds); } }