/// <summary> /// Ticks this instance. /// </summary> public override void Tick() { LogicArrayList <LogicComponent> components = this._parent.GetComponentManager().GetComponents(15); int barrackCount = this._parent.GetGameObjectManager().GetBarrackCount(); int barrackFoundCount = 0; if (barrackCount > 0) { int idx = 0; do { LogicBuilding building = (LogicBuilding)this._parent.GetGameObjectManager().GetBarrack(idx); if (building != null && !building.IsConstructing()) { barrackFoundCount += 1; } } while (++idx != barrackCount); } this._noBarrack = barrackFoundCount == 0; for (int i = 0; i < components.Count; i++) { LogicVillage2UnitComponent component = (LogicVillage2UnitComponent)components[i]; if (barrackFoundCount != 0) { if (component == this) { break; } } if (component != null) { if (component._unit != null) { if (component._unit.GetData() != null && component._unit.GetCount() == 0) { if (component.GetRemainingSecs() > 0) { if (this._trainingTimer != null) { this._trainingTimer.StartTimer(this._trainingTimer.GetRemainingSeconds(this._parent.GetLevel().GetLogicTime()), this._parent.GetLevel().GetLogicTime(), false, -1); } return; } } } } } if (this._trainingTimer != null) { if (this._parent.GetLevel().GetRemainingClockTowerBoostTime() > 0) { if (this._parent.GetData().GetDataType() == 0) { if (this._parent.GetData().GetVillageType() == 1) { this._trainingTimer.FastForwardSubticks(4 * LogicDataTables.GetGlobals().GetClockTowerBoostMultiplier() - 4); } } } } if (this.GetParent() != null) { LogicGameObject gameObject = this.GetParent(); if (gameObject.GetListener() != null) { } } if (this._trainingTimer != null) { if (this._trainingTimer.GetRemainingSeconds(this._parent.GetLevel().GetLogicTime()) <= 0) { if (this._unit != null) { this.TrainingFinished(); } } } }