예제 #1
0
파일: World.cs 프로젝트: EikeStein/HexMex
 private void CheckWinCondition(GlobalResourceManager globalResourceManager)
 {
     if (globalResourceManager.EnvironmentResource.WinStep >= GameSettings.GameplaySettings.PalastWinSteps)
     {
         OnVictory();
     }
 }
예제 #2
0
 public UnlockManager(GlobalResourceManager globalResourceManager, BuildingDescriptionDatabase buildingDescriptionDatabase)
 {
     GlobalResourceManager = globalResourceManager;
     foreach (var buildingDescription in buildingDescriptionDatabase.BuildingDescriptions)
     {
         UnlockedStructures.Add(buildingDescription, buildingDescription.UnlockCost == Knowledge.Zero);
     }
 }
예제 #3
0
 public void Unlock(BuildingDescription structureDescription)
 {
     if (!GlobalResourceManager.EnoughKnowledgeFor(structureDescription.UnlockCost))
     {
         throw new InvalidOperationException("Not enough knowledge aquired");
     }
     GlobalResourceManager.Knowledge         -= structureDescription.UnlockCost;
     UnlockedStructures[structureDescription] = true;
     NewStructureUnlocked?.Invoke(this, structureDescription);
 }
예제 #4
0
파일: World.cs 프로젝트: EikeStein/HexMex
 public World(GameSettings gameSettings)
 {
     GameSettings                        = gameSettings;
     StructureManager                    = new StructureManager();
     GlobalResourceManager               = new GlobalResourceManager(GameSettings.GameplaySettings);
     HexagonManager                      = new HexagonManager(GameSettings.GameplaySettings);
     ButtonManager                       = new ButtonManager(GameSettings.LayoutSettings);
     UnlockManager                       = new UnlockManager(GlobalResourceManager, gameSettings.BuildingDescriptionDatabase);
     PathFinder                          = new CachedPathFinder(HexagonManager, StructureManager, GameSettings.GameplaySettings);
     ResourceManager                     = new ResourceManager(this);
     StructureManager.StructureAdded    += StructureAdded;
     StructureManager.StructureRemoved  += StructureRemoved;
     GlobalResourceManager.OutOfOxygen  += grm => OnDefeat();
     GlobalResourceManager.ValueChanged += CheckWinCondition;
 }