Esempio n. 1
0
        public static void PlaceAStructure(Texture2D texture)
        {
            adjustedCoordinates = new Vector2(Engine.Engine.MouseCoordinates.X, Engine.Engine.MouseCoordinates.Y);

            Engine.Engine.Blueprint = new Rectangle((int)adjustedCoordinates.X - (texture.Width / 2),
                                                    (int)adjustedCoordinates.Y - (texture.Width / 2), texture.Width, texture.Height);

            if (CheckMouseStateChange.IsMouseClicked() && CheckIfGroundClear(Engine.Engine.Blueprint))
            {
                switch (SelectedStructure)
                {
                case BuildingSelected.SmallTent:
                    Tent.CreateSmallTent(adjustedCoordinates, Engine.Engine.Blueprint);
                    break;

                case BuildingSelected.LargeTent:
                    Tent.CreateLargeTent(adjustedCoordinates, Engine.Engine.Blueprint);
                    break;
                }

                IsPlacingBuilding = false;
                BuildMenuInteraction.IsBuildMenuOpen = false;
                SelectedStructure = BuildingSelected.None;
            }
        }
Esempio n. 2
0
        public static void CreateSmallTent(Vector2 position, Rectangle bRec)
        {
            Tent smallTent = new Tent
            {
                Texture       = Textures.SmallTentTexture,
                ID            = Guid.NewGuid().ToString(),
                Position      = new Vector2(position.X, position.Y),
                BRec          = bRec,
                Name          = "Small Tent",
                Description   = "A flimsy 2-person tent",
                MaxHealth     = 80,
                CurrentHealth = 80
            };

            smallTent.BRec.X = (int)smallTent.Position.X;
            smallTent.BRec.Y = (int)smallTent.Position.Y;

            smallTent.BRec.Width  = Textures.SmallTentTexture.Width;
            smallTent.BRec.Height = Textures.SmallTentTexture.Height;

            EntityLists.BuildingList.Add(smallTent);
            PruneFoliage.CheckBushBuildingIntersection(smallTent);
        }