protected override void Initialize(XElement extensionElement, GamePack package) { XElement canPass = extensionElement.Element(package.PackageManager.GetQualifiedXName(PassableTileTypesElement)); PassableTileTypes = ViableTileTypes.FromXml(canPass, package); }
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)); }
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); }
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); }
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); }
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); }
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))); }