예제 #1
0
파일: Bulldozer.cs 프로젝트: Ratstool/Zeds
        public static void DemolishStructure()
        {
            IsDemolitionLegal = true;

            foreach (var building in EntityLists.BuildingList)
            {
                if (Cursor.CursorRectangle.Intersects(building.BRec))
                {
                    if (building.Description == "Operations Base")
                    {
                        IsDemolitionLegal = false;
                    }

                    if (IsDemolitionLegal && CheckMouseStateChange.IsMouseClicked())
                    {
                        EntityLists.BuildingList.Remove(building);
                        break;
                    }
                }
            }
        }
예제 #2
0
        public static void CheckForMouseInput()
        {
            if (currentMouseState.ScrollWheelValue > PreviousScrollValue && Engine.Camera.Zoom <= 1.8)
            {
                Engine.Camera.Zoom += 0.1f;
            }

            if (currentMouseState.ScrollWheelValue > PreviousScrollValue && Engine.Camera.Zoom >= 0.2)
            {
                Engine.Camera.Zoom -= 0.1f;
            }

            PreviousScrollValue = currentMouseState.ScrollWheelValue;


            if (BuildMenuInteraction.IsBuildMenuOpen)
            {
                bool intersects = false;
                foreach (var icon in EntityLists.BuildIconList)
                {
                    if (Cursor.CursorRectangle.Intersects(icon.BRec))
                    {
                        intersects = true;
                    }
                }

                foreach (var icon in EntityLists.MainIconList)
                {
                    if (Cursor.CursorRectangle.Intersects(icon.BRec))
                    {
                        intersects = true;
                    }
                }

                if (!intersects && CheckMouseStateChange.IsMouseClicked())
                {
                    BuildMenuInteraction.IsBuildMenuOpen = false;
                }
            }
        }