コード例 #1
0
        protected virtual void AddedToWorld(Actor self)
        {
            if (Info.RemoveSmudgesOnBuild)
            {
                RemoveSmudges();
            }

            self.World.AddToMaps(self, this);
            influence.AddInfluence(self, Info.Tiles(self.Location));
        }
コード例 #2
0
ファイル: Building.cs プロジェクト: cjshmyr/OpenRA
        protected virtual void AddedToWorld(Actor self)
        {
            if (Info.RemoveSmudgesOnBuild)
            {
                RemoveSmudges();
            }

            self.World.ActorMap.AddInfluence(self, this);
            self.World.ActorMap.AddPosition(self, this);

            if (!self.Bounds.Size.IsEmpty)
            {
                self.World.ScreenMap.Add(self);
            }

            influence.AddInfluence(self, Info.Tiles(self.Location));
        }
コード例 #3
0
		public static bool CanPlaceBuilding(this World world, CPos cell, ActorInfo ai, BuildingInfo bi, Actor toIgnore)
		{
			if (bi.AllowInvalidPlacement)
				return true;

			var resourceLayer = world.WorldActor.TraitOrDefault<IResourceLayer>();
			return bi.Tiles(cell).All(t => world.Map.Contains(t) &&
				(bi.AllowPlacementOnResources || resourceLayer == null || resourceLayer.GetResource(t).Type == null) &&
					world.IsCellBuildable(t, ai, bi, toIgnore));
		}
コード例 #4
0
        public void RemoveSmudges()
        {
            var smudgeLayers = self.World.WorldActor.TraitsImplementing <SmudgeLayer>();

            foreach (var smudgeLayer in smudgeLayers)
            {
                foreach (var footprintTile in Info.Tiles(self.Location))
                {
                    smudgeLayer.RemoveSmudge(footprintTile);
                }
            }
        }
コード例 #5
0
        public static bool CanPlaceBuilding(this World world, string name, BuildingInfo building, CPos topLeft, Actor toIgnore)
        {
            if (building.AllowInvalidPlacement)
            {
                return(true);
            }

            var res = world.WorldActor.TraitOrDefault <ResourceLayer>();

            return(building.Tiles(topLeft).All(
                       t => world.Map.Contains(t) && (res == null || res.GetResource(t) == null) &&
                       world.IsCellBuildable(t, building, toIgnore)));
        }
コード例 #6
0
        public static bool CanPlaceBuilding(this World world, CPos cell, ActorInfo ai, BuildingInfo bi, Actor toIgnore)
        {
            if (bi.AllowInvalidPlacement)
            {
                return(true);
            }

            var res = world.WorldActor.TraitOrDefault <ResourceLayer>();

            return(bi.Tiles(cell).All(
                       t => world.Map.Contains(t) && (res == null || res.GetResourceType(t) == null) &&
                       world.IsCellBuildable(t, ai, bi, toIgnore)));
        }