Esempio n. 1
0
        public void AddTileGroup(string groupId_, string itemId_, float xpos_, float itemY_)
        {
            float height = 96;

            if (ticktock == 20)
            {
                ticktock = 0;
            }
            List <Entity> ents = new List <Entity>();

            if (addCeiling)
            {
                ents.Add(ebuilder.CreateEntity("tile", GetDrawerCollection(6), new Vector2(xpos_, 0), new List <Property>()
                {
                    new Property("isTile", "isTile", "isTile")
                }, "tile"));
            }
            addCeiling = !addCeiling;
            switch (groupId_)
            {
            case "basic":
                if (ticktock == 0)
                {
                    ents.Add(ebuilder.CreateEntity("tile", GetDrawerCollection(12), new Vector2(xpos_, height), new List <Property>()
                    {
                        new Property("isTile", "isTile", "isTile")
                    }, "tile"));
                }
                break;

            case "void":
                if (nextFloorType == "rand")
                {
                    nextFloorType = "void2";
                }
                else if (int.Parse(nextFloorType.Substring(4)) < 10)
                {
                    nextFloorType = "void" + (int.Parse(nextFloorType.Substring(4)) + 1).ToString();
                }
                else
                {
                    nextFloorType = "rand"; groupCooldowns[1] = 20;
                }
                break;
            }
            if (itemId_ != "none")
            {
                Entity ent = Assembler.GetEnt(ElementCollection.GetEntRef(itemId_), new Vector2(xpos_, itemY_), content, ebuilder, false);
                ent.AddProperty(new Property("isCollectible", "isCollectible", "isCollectible"));
                ents.Add(ent);
                itemCount++;
            }
            EntityCollection.AddEntities(ents);
            ticktock++;
        }
Esempio n. 2
0
        public void SetupTiles()
        {
            List <Entity> ents = new List <Entity>();

            ents.Add(ebuilder.CreateEntity("tile", GetDrawerCollection(12), new Vector2(0, 96), new List <Property>()
            {
                new Property("isTile", "isTile", "isTile")
            }, "tile"));
            ents.Add(ebuilder.CreateEntity("tile", GetDrawerCollection(12), new Vector2(160, 96), new List <Property>()
            {
                new Property("isTile", "isTile", "isTile")
            }, "tile"));
            for (int i = -10; i <= 30; i++)
            {
                ents.Add(ebuilder.CreateEntity("tile", GetDrawerCollection(6), new Vector2(32 * i, 0), new List <Property>()
                {
                    new Property("isTile", "isTile", "isTile")
                }, "tile"));
            }
            for (int i = -2; i <= 6; i++)
            {
                ents.Add(ebuilder.CreateEntity("tile", GetDrawerCollection(12), new Vector2(160 * i, 96), new List <Property>()
                {
                    new Property("isTile", "isTile", "isTile")
                }, "tile"));
            }
            for (int i = 0; i < 5; i++)
            {
                Random r   = new Random();
                int    x   = r.Next(1, 5);
                Entity ent = ebuilder.CreateEntity("bg", GetDrawerCollection(x), new Vector2(i * 96 + 48, 64), new List <Property>()
                {
                    new Property("isBG", "isBG", "isBG")
                }, "bg");
                EntityCollection.AddEntity(ent);
            }
            EntityCollection.AddEntities(ents);
        }
Esempio n. 3
0
        void CreateNewGame()
        {
            ParticleSystem.Flush();

            EntityCollection.Flush();

            GameData.Initialize();

            CreateGod();

            Building church = new Building(
                new DrawerCollection(
                    new List <TextureDrawer>()
            {
                SpriteSheetCollection.GetTex("idle", "defBuildings", "church"),
                SpriteSheetCollection.GetTex("hovered", "defBuildings", "church"),
                SpriteSheetCollection.GetTex("idle", "defBuildings", "church")
            },
                    "church"),
                new PositionManager(new Vector2(217, 8)),
                new List <Property>(),
                .1f,
                "church",
                "this is a building"
                );
            Building field = new Building(
                new DrawerCollection(
                    new List <TextureDrawer>()
            {
                SpriteSheetCollection.GetTex("idle", "defBuildings", "farm"),
                SpriteSheetCollection.GetTex("hovered", "defBuildings", "farm"),
                SpriteSheetCollection.GetTex("clicked", "defBuildings", "farm")
            },
                    "field"),
                new PositionManager(new Vector2(53, 131)),
                new List <Property>(),
                .1f,
                "field",
                "this is a building"
                );
            Building mine = new Building(
                new DrawerCollection(
                    new List <TextureDrawer>()
            {
                SpriteSheetCollection.GetTex("idle", "defBuildings", "mine"),
                SpriteSheetCollection.GetTex("hovered", "defBuildings", "mine"),
                SpriteSheetCollection.GetTex("idle", "defBuildings", "mine")
            },
                    "mine"),
                new PositionManager(new Vector2(31, 55)),
                new List <Property>(),
                .1f,
                "mine",
                "this is a building"
                );
            Building forest = new Building(
                new DrawerCollection(
                    new List <TextureDrawer>()
            {
                SpriteSheetCollection.GetTex("idle", "defBuildings", "forest"),
                SpriteSheetCollection.GetTex("hovered", "defBuildings", "forest"),
                SpriteSheetCollection.GetTex("idle", "defBuildings", "forest")
            },
                    "forest"),
                new PositionManager(new Vector2(0, 89)),
                new List <Property>(),
                .1f,
                "forest",
                "this is a building"
                );
            Building city = new Building(
                new DrawerCollection(
                    new List <TextureDrawer>()
            {
                SpriteSheetCollection.GetTex("idle", "defBuildings", "city"),
                SpriteSheetCollection.GetTex("hovered", "defBuildings", "city"),
                SpriteSheetCollection.GetTex("clicked", "defBuildings", "city")
            },
                    "city"),
                new PositionManager(new Vector2(204, 112)),
                new List <Property>(),
                .1f,
                "city",
                "this is a building"
                );
            Building bridge = new Building(
                new DrawerCollection(
                    new List <TextureDrawer>()
            {
                SpriteSheetCollection.GetTex("idle", "defBuildings", "bridge"),
                SpriteSheetCollection.GetTex("hovered", "defBuildings", "bridge"),
                SpriteSheetCollection.GetTex("clicked", "defBuildings", "bridge")
            },
                    "bridge"),
                new PositionManager(new Vector2(111, 133)),
                new List <Property>(),
                .1f,
                "bridge",
                "this is a building"
                );

            EntityCollection.CreateGroup("building", "buildings");
            EntityCollection.CreateGroup("c**t", "villagers");
            EntityCollection.CreateGroup("god", "god");
            EntityCollection.AddEntities(new List <Entity>()
            {
                church, field, mine, forest, city, bridge
            });
        } //create whatever's needed to start a new game