Пример #1
0
        protected override void Initialize(XElement extensionElement, GamePack package)
        {
            XElement canPass =
                extensionElement.Element(package.PackageManager.GetQualifiedXName(PassableTileTypesElement));

            PassableTileTypes = ViableTileTypes.FromXml(canPass, package);
        }
Пример #2
0
 public override bool CanBuild(IntVector2 topLeftTileIndex, IPlayer owner, ILevelManager level)
 {
     return(owner.GetBuildingsOfType(MyTypeInstance).Count == 0 &&
            level.Map
            .GetTilesInRectangle(MyTypeInstance.GetBuildingTilesRectangle(topLeftTileIndex))
            .All((tile) => tile.Building == null && tile.Units.Count == 0 && ViableTileTypes.IsViable(tile)) &&
            HeightDiffLow(topLeftTileIndex, MyTypeInstance.GetBottomRightTileIndex(topLeftTileIndex), level, MaxHeightDiff));
 }
Пример #3
0
        protected override void Initialize(XElement extensionElement, GamePack package)
        {
            MyTypeInstance = package.GetBuildingType(ID);

            XElement costElem = extensionElement.Element(package.PackageManager.GetQualifiedXName(CostElement));

            Cost = Cost.FromXml(costElem, package);

            XElement canBuildOnElem =
                extensionElement.Element(package.PackageManager.GetQualifiedXName(CanBuildOnElement));

            ViableTileTypes = ViableTileTypes.FromXml(canBuildOnElem, package);
        }
Пример #4
0
        protected override void Initialize(XElement extensionElement, GamePack package)
        {
            XElement costElem = extensionElement.Element(package.PackageManager.GetQualifiedXName(CostElement));

            cost = Cost.FromXml(costElem, package);

            XElement canPass =
                extensionElement.Element(package.PackageManager.GetQualifiedXName(PassableTileTypesElement));

            PassableTileTypes = ViableTileTypes.FromXml(canPass, package);

            myType = package.GetUnitType(ID);
        }
Пример #5
0
        protected override void Initialize(XElement extensionElement, GamePack package)
        {
            MyTypeInstance = package.GetBuildingType(ID);

            XElement canBuildOnElem =
                extensionElement.Element(package.PackageManager.GetQualifiedXName(CanBuildOnElement));

            ViableTileTypes = ViableTileTypes.FromXml(canBuildOnElem, package);

            XElement producedResourceElem =
                extensionElement.Element(package.PackageManager.GetQualifiedXName(ProducedResourceElement));

            ProducedResource = package.GetResourceType(producedResourceElem.Value);
            ProductionRate   = double.Parse(producedResourceElem.Attribute(ProductionRateAttribute).Value);
        }
Пример #6
0
        protected override void Initialize(XElement extensionElement, GamePack package)
        {
            MyTypeInstance = package.GetBuildingType(TypeID);

            XElement workerElement = extensionElement.Element(package.PackageManager.GetQualifiedXName(WorkerElement));

            WorkerType = package.GetUnitType(workerElement.Value);

            XElement resourceElement =
                extensionElement.Element(package.PackageManager.GetQualifiedXName(ResourceElement));

            ProducedResource = package.GetResourceType(resourceElement.Value);

            XElement costElem = extensionElement.Element(package.PackageManager.GetQualifiedXName(CostElement));

            Cost = Cost.FromXml(costElem, package);

            XElement canBuildOnElem =
                extensionElement.Element(package.PackageManager.GetQualifiedXName(CanBuildOnElement));

            ViableTileTypes = ViableTileTypes.FromXml(canBuildOnElem, package);
        }
Пример #7
0
 public override bool CanBuild(IntVector2 topLeftTileIndex, IPlayer owner, ILevelManager level)
 {
     return(level.Map
            .GetTilesInRectangle(MyTypeInstance.GetBuildingTilesRectangle(topLeftTileIndex))
            .All((tile) => tile.Building == null && tile.Units.Count == 0 && ViableTileTypes.IsViable(tile)));
 }