Пример #1
0
        public void SelectBuilding(Building b)
        {
            _selectedBuilding = b;

            _selectionParts.Clear();

            _selectionParts.Add(new SelectionPart() { Point = new Point(b.Position.X, b.Position.Y), Type = SelectionPartType.TopLeft});
            _selectionParts.Add(new SelectionPart() { Point = new Point(b.Position.X + b.Dimentions.X - 1, b.Position.Y), Type = SelectionPartType.TopRight});
            _selectionParts.Add(new SelectionPart() { Point = new Point(b.Position.X, b.Position.Y + b.Dimentions.Y -1), Type = SelectionPartType.BottomLeft});
            _selectionParts.Add(new SelectionPart() { Point = new Point(b.Position.X + b.Dimentions.X - 1, b.Position.Y + b.Dimentions.Y -1), Type = SelectionPartType.BottomRight});

            if (b.IsBuildingConstructed() == false)
            {
                GuiSystem.AddGuiComponent(new UnderConstruction(new Vector2(MouseInput.X, MouseInput.Y - 300)));
            }
            else if (b.GetType().IsSubclassOf(typeof(Tower)))
            {
                GuiSystem.AddGuiComponent(new TowerWindow(new Vector2(MouseInput.X, MouseInput.Y - 300),  (Tower)b));
            }
            else
            {
                b.ShowBuildingWindow(new Vector2(MouseInput.X, MouseInput.Y));
            }
        }