コード例 #1
0
ファイル: Building.cs プロジェクト: hadow/Commander
        protected virtual void AddedToWorld(Actor self)
        {
            if (Info.RemoveSmudgesOnBuild)
            {
                RemoveSmudges();
            }

            self.World.AddToMaps(self, this);
            influence.AddInfluence(self, Info.Tiles(self.Location));
        }
コード例 #2
0
ファイル: BuildingUtils.cs プロジェクト: hadow/Commander
        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)));
        }