Example #1
0
        public D2kActorPreviewPlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, D2kActorPreviewPlaceBuildingPreviewInfo info, TypeDictionary init)
            : base(wr, ai, info, init)
        {
            this.info = info;

            var world     = wr.World;
            var sequences = world.Map.Rules.Sequences;

            var techTree = init.Get <OwnerInit>().Value(world).PlayerActor.Trait <TechTree>();

            checkUnsafeTiles = info.RequiresPrerequisites.Any() && techTree.HasPrerequisites(info.RequiresPrerequisites);

            var validSequence = sequences.GetSequence(info.Image, info.TileValidName);

            validTile  = validSequence.GetSprite(0);
            validAlpha = validSequence.GetAlpha(0);

            var unsafeSequence = sequences.GetSequence(info.Image, info.TileUnsafeName);

            unsafeTile  = unsafeSequence.GetSprite(0);
            unsafeAlpha = unsafeSequence.GetAlpha(0);

            var blockedSequence = sequences.GetSequence(info.Image, info.TileInvalidName);

            blockedTile  = blockedSequence.GetSprite(0);
            blockedAlpha = blockedSequence.GetAlpha(0);

            var buildingInfo = ai.TraitInfo <BuildingInfo>();

            unpathableCells = new CachedTransform <CPos, List <CPos> >(topLeft => buildingInfo.OccupiedTiles(topLeft).ToList());
        }
Example #2
0
        public D2kActorPreviewPlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, D2kActorPreviewPlaceBuildingPreviewInfo info, TypeDictionary init)
            : base(wr, ai, info, init)
        {
            this.info = info;

            var world     = wr.World;
            var sequences = world.Map.Rules.Sequences;

            buildOk      = sequences.GetSequence("overlay", "build-valid").GetSprite(0);
            buildUnsafe  = sequences.GetSequence("overlay", "build-unsafe").GetSprite(0);
            buildBlocked = sequences.GetSequence("overlay", "build-invalid").GetSprite(0);

            var buildingInfo = ai.TraitInfo <BuildingInfo>();

            unpathableCells = new CachedTransform <CPos, List <CPos> >(topLeft => buildingInfo.OccupiedTiles(topLeft).ToList());
        }
Example #3
0
        public D2kActorPreviewPlaceBuildingPreviewPreview(WorldRenderer wr, ActorInfo ai, D2kActorPreviewPlaceBuildingPreviewInfo info, TypeDictionary init)
            : base(wr, ai, info, init)
        {
            this.info = info;

            var world     = wr.World;
            var sequences = world.Map.Rules.Sequences;

            var techTree = init.Get <OwnerInit>().Value(world).PlayerActor.Trait <TechTree>();

            checkUnsafeTiles = info.RequiresPrerequisites.Any() && techTree.HasPrerequisites(info.RequiresPrerequisites);

            buildOk      = sequences.GetSequence("overlay", "build-valid").GetSprite(0);
            buildUnsafe  = sequences.GetSequence("overlay", "build-unsafe").GetSprite(0);
            buildBlocked = sequences.GetSequence("overlay", "build-invalid").GetSprite(0);

            var buildingInfo = ai.TraitInfo <BuildingInfo>();

            unpathableCells = new CachedTransform <CPos, List <CPos> >(topLeft => buildingInfo.OccupiedTiles(topLeft).ToList());
        }