private bool m_vIsSpellForge;//a1 + 24 public UnitProductionComponent(GameObject go) : base(go) { m_vUnits = new List<DataSlot>(); SetUnitType(go); m_vTimer = null; m_vIsWaitingForSpace = false; }
public void ClearingFinished() { //gérer achievement //gérer xp reward //gérer obstacleclearcounter //gérer diamond reward m_vLevel.WorkerManager.DeallocateWorker(this); m_vTimer = null; }
public void CancelClearing() { m_vLevel.WorkerManager.DeallocateWorker(this); m_vTimer = null; var od = GetObstacleData(); var rd = od.GetClearingResource(); int cost = od.ClearCost; GetLevel().GetPlayerAvatar().CommodityCountChangeHelper(0, rd, cost); }
public void FinishUpgrading() { ClientAvatar ca = GetParent().GetLevel().GetPlayerAvatar(); int currentLevel = ca.GetUnitUpgradeLevel(m_vHeroData); ca.SetUnitUpgradeLevel(m_vHeroData, currentLevel + 1); //(*(*v3 + 160))(v3, 1, *(v1 + 16), 1); GetParent().GetLevel().WorkerManager.DeallocateWorker(GetParent()); //SetHeroState (*(*v3 + 224))(v3, *(v1 + 16), 3); m_vTimer = null; }
public void FinishUpgrading() { if(m_vCurrentlyUpgradedUnit != null) { ClientAvatar ca = GetParent().GetLevel().GetHomeOwnerAvatar(); int level = ca.GetUnitUpgradeLevel(m_vCurrentlyUpgradedUnit); ca.SetUnitUpgradeLevel(m_vCurrentlyUpgradedUnit, level + 1); } m_vTimer = null; m_vCurrentlyUpgradedUnit = null; }
public void StartClearing() { int constructionTime = GetObstacleData().ClearTimeSeconds; if (constructionTime < 1) { ClearingFinished(); } else { m_vTimer = new Timer(); m_vTimer.StartTimer(constructionTime, m_vLevel.GetTime()); m_vLevel.WorkerManager.AllocateWorker(this); } }
public void CancelUpgrade() { if(m_vTimer != null) { var ca = GetParent().GetLevel().GetPlayerAvatar(); int currentLevel = ca.GetUnitUpgradeLevel(m_vHeroData); ResourceData rd = m_vHeroData.GetUpgradeResource(currentLevel); int cost = m_vHeroData.GetUpgradeCost(currentLevel); int multiplier = ObjectManager.DataTables.GetGlobals().GetGlobalData("HERO_UPGRADE_CANCEL_MULTIPLIER").NumberValue; int resourceCount = (int)((((long)(cost * multiplier)) * (long)1374389535) >> 32); resourceCount = Math.Max((resourceCount >> 5) + (resourceCount >> 31), 0); ca.CommodityCountChangeHelper(0, rd, resourceCount); GetParent().GetLevel().WorkerManager.DeallocateWorker(GetParent()); //todo: setherostate (*(*v2 + 224))(v2, *(v1 + 16), 3); m_vTimer = null; } }
public void AddUnitToProductionQueue(CombatItemData cd) { if(CanAddUnitToQueue(cd)) { for(int i=0;i<GetSlotCount();i++) { if ((CombatItemData)m_vUnits[i].Data == cd) { m_vUnits[i].Value++; return; } } DataSlot ds = new DataSlot(cd, 1); m_vUnits.Add(ds); if(m_vTimer == null) { ClientAvatar ca = GetParent().GetLevel().GetHomeOwnerAvatar(); m_vTimer = new Timer(); int trainingTime = cd.GetTrainingTime(ca.GetUnitUpgradeLevel(cd)); m_vTimer.StartTimer(trainingTime, GetParent().GetLevel().GetTime()); } } }
public void RemoveUnit(CombatItemData cd) { int index = -1; if(GetSlotCount() >= 1) { for(int i=0;i<GetSlotCount();i++) { if (m_vUnits[i].Data == cd) index = i; } } if(index != -1) { if (m_vUnits[index].Value >= 1) { m_vUnits[index].Value--; if (m_vUnits[index].Value == 0) { m_vUnits.RemoveAt(index); if(GetSlotCount() >= 1) { DataSlot ds = m_vUnits[0]; CombatItemData newcd = (CombatItemData)m_vUnits[0].Data; ClientAvatar ca = GetParent().GetLevel().GetHomeOwnerAvatar(); m_vTimer = new Timer(); int trainingTime = newcd.GetTrainingTime(ca.GetUnitUpgradeLevel(newcd)); m_vTimer.StartTimer(trainingTime, GetParent().GetLevel().GetTime()); } } } } }
public override void Load(JObject jsonObject) { JObject unitUpgradeObject = (JObject)jsonObject["unit_upg"]; if (unitUpgradeObject != null) { m_vTimer = new Timer(); int remainingTime = unitUpgradeObject["t"].ToObject<int>(); m_vTimer.StartTimer(remainingTime, GetParent().GetLevel().GetTime()); int id = unitUpgradeObject["id"].ToObject<int>(); m_vCurrentlyUpgradedUnit = (CombatItemData)ObjectManager.DataTables.GetDataById(id); } }
public void StartUpgrading(CombatItemData cid) { if(CanStartUpgrading(cid)) { m_vCurrentlyUpgradedUnit = cid; m_vTimer = new Timer(); m_vTimer.StartTimer(GetTotalSeconds(), GetParent().GetLevel().GetTime()); } }
public new void Load(JObject jsonObject) { this.UpgradeLevel = jsonObject["lvl"].ToObject<int>(); this.m_vLevel.WorkerManager.DeallocateWorker(this); var constTimeToken = jsonObject["const_t"]; if( constTimeToken != null) { m_vTimer = new Timer(); this.m_vIsConstructing = true; int remainingConstructionTime = constTimeToken.ToObject<int>(); m_vTimer.StartTimer(remainingConstructionTime, m_vLevel.GetTime());//a changer ici, utilise seconds_from_last_respawn? this.m_vLevel.WorkerManager.AllocateWorker(this); } this.Locked = false; var lockedToken = jsonObject["locked"]; if (lockedToken != null) { this.Locked = lockedToken.ToObject<bool>(); } this.SetUpgradeLevel(this.UpgradeLevel); base.Load(jsonObject); }
public void StartUpgrading() { int constructionTime = GetConstructionItemData().GetConstructionTime(UpgradeLevel + 1); if (constructionTime < 1) { FinishConstruction(); } else { //todo : collecter les ressources avant upgrade si un component de ressources est défini m_vIsConstructing = true; m_vTimer = new Timer(); m_vTimer.StartTimer(constructionTime, m_vLevel.GetTime()); m_vLevel.WorkerManager.AllocateWorker(this); } }
public void StartConstructing(int newX, int newY) { this.X = newX; this.Y = newY; int constructionTime = GetConstructionItemData().GetConstructionTime(UpgradeLevel + 1); if (constructionTime < 1) { FinishConstruction(); } else { m_vTimer = new Timer(); m_vTimer.StartTimer(constructionTime, m_vLevel.GetTime()); m_vLevel.WorkerManager.AllocateWorker(this); m_vIsConstructing = true; } }
public override void Load(JObject jsonObject) { JObject unitUpgradeObject = (JObject)jsonObject["hero_upg"]; if (unitUpgradeObject != null) { m_vTimer = new Timer(); int remainingTime = unitUpgradeObject["t"].ToObject<int>(); m_vTimer.StartTimer(remainingTime, GetParent().GetLevel().GetTime()); m_vUpgradeLevelInProgress = unitUpgradeObject["level"].ToObject<int>(); } }
public override void Load(JObject jsonObject) { JObject unitProdObject = (JObject)jsonObject["unit_prod"]; m_vIsSpellForge = (unitProdObject["unit_type"].ToObject<int>() == 1); var timeToken = unitProdObject["t"]; if (timeToken != null) { m_vTimer = new Timer(); int remainingTime = timeToken.ToObject<int>(); m_vTimer.StartTimer(remainingTime, GetParent().GetLevel().GetTime()); } JArray unitJsonArray = (JArray)unitProdObject["slots"]; if (unitJsonArray != null) { foreach (JObject unitJsonObject in unitJsonArray) { int id = unitJsonObject["id"].ToObject<int>(); int cnt = unitJsonObject["cnt"].ToObject<int>(); m_vUnits.Add(new DataSlot(ObjectManager.DataTables.GetDataById(id),cnt)); } } }
private CombatItemData m_vCurrentlyUpgradedUnit;//a1 + 16 //a1 + 20 -- Listener? public UnitUpgradeComponent(GameObject go) : base(go) { m_vTimer = null; m_vCurrentlyUpgradedUnit = null; }
public void StartProducingNextUnit() { m_vTimer = null; if (GetSlotCount() >= 1) { RemoveUnit((CombatItemData)m_vUnits[0].Data); } }
public void StartUpgrading() { if(CanStartUpgrading()) { GetParent().GetLevel().WorkerManager.AllocateWorker(GetParent()); m_vTimer = new Timer(); m_vTimer.StartTimer(GetTotalSeconds(), GetParent().GetLevel().GetTime()); m_vUpgradeLevelInProgress = GetParent().GetLevel().GetPlayerAvatar().GetUnitUpgradeLevel(m_vHeroData) + 1; //SetHeroState v27(v24, v26, 1); //Not 100% done } }