public bool FinishTaskOfOneWorker() { LogicGameObject gameObject = this.GetShortestTaskGO(); if (gameObject != null) { switch (gameObject.GetGameObjectType()) { case LogicGameObjectType.BUILDING: LogicBuilding building = (LogicBuilding)gameObject; if (building.IsConstructing()) { return(building.SpeedUpConstruction()); } if (building.GetHeroBaseComponent() != null) { return(building.GetHeroBaseComponent().SpeedUp()); } break; case LogicGameObjectType.OBSTACLE: LogicObstacle obstacle = (LogicObstacle)gameObject; if (obstacle.IsClearingOnGoing()) { return(obstacle.SpeedUpClearing()); } break; case LogicGameObjectType.TRAP: LogicTrap trap = (LogicTrap)gameObject; if (trap.IsConstructing()) { return(trap.SpeedUpConstruction()); } break; case LogicGameObjectType.VILLAGE_OBJECT: LogicVillageObject villageObject = (LogicVillageObject)gameObject; if (villageObject.IsConstructing()) { return(villageObject.SpeedUpCostruction()); } break; } } return(false); }
/// <summary> /// Finishes the task of one worker. /// </summary> public bool FinishTaskOfOneWorker() { LogicGameObject gameObject = this.GetShortestTaskGO(); if (gameObject != null) { switch (gameObject.GetGameObjectType()) { case 0: LogicBuilding building = (LogicBuilding)gameObject; if (building.IsConstructing()) { return(building.SpeedUpConstruction()); } if (building.GetHeroBaseComponent() != null) { // TODO: Implement LogicHeroBaseComponent::speedUpUpgrade. } break; case 3: LogicObstacle obstacle = (LogicObstacle)gameObject; if (obstacle.IsClearingOnGoing()) { return(obstacle.SpeedUpClearing()); } break; case 4: LogicTrap trap = (LogicTrap)gameObject; if (trap.IsConstructing()) { return(trap.SpeedUpConstruction()); } break; case 8: LogicVillageObject villageObject = (LogicVillageObject)gameObject; break; } } return(false); }