Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
0
        protected Structure(HexagonNode position, World world, BuildingDescription description)
        {
            World            = world;
            Description      = description;
            Position         = position;
            ResourceDirector = new ResourceDirector(this);
            var hex1 = World.HexagonManager[position.Position1];
            var hex2 = World.HexagonManager[position.Position2];
            var hex3 = World.HexagonManager[position.Position3];

            hex1.Payout += OnAdjacentHexagonProvidedResource;
            hex2.Payout += OnAdjacentHexagonProvidedResource;
            hex3.Payout += OnAdjacentHexagonProvidedResource;
        }
Ejemplo n.º 3
0
 public bool this[BuildingDescription structureDescription] => UnlockedStructures[structureDescription];
Ejemplo n.º 4
0
 private BuildingConstructionFactory(Type type, BuildingDescription structureDescription, Func <HexagonNode, World, Structure> createFunction)
 {
     Type                 = type;
     CreateFunction       = createFunction;
     StructureDescription = structureDescription;
 }