Beispiel #1
0
        public override bool RayCast(GameTime gameTime)
        {
            if (MouseManager.MouseClicked && !EditorSelected)
            {
                if (Logic.Rect(Position.get(), Size.get(), Parent2DScene.DrawCamera.ViewMatrix).Contains(WorldViewer.self.RelativeMousePoint))
                {
                    if (!KeyboardManager.ControlPressed())
                    {
                        if (!KeyboardManager.ShiftPressed())
                        {
                            ParentScene.ClearSelected();
                        }
                        ParentScene.AddSelected(this);
                    }
                    else
                    {
                        if (EditorSelected)
                        {
                            ParentScene.RemoveSelected(this);
                        }
                        else
                        {
                            ParentScene.AddSelected(this);
                        }
                    }
                    ParentLevel.ModifyWindows();
                    return(true);
                }
            }
            else if (MouseManager.RMouseClicked)
            {
                if (Logic.Rect(Position.get(), Size.get(), Parent2DScene.DrawCamera.ViewMatrix).Contains(WorldViewer.self.RelativeMousePoint))
                {
                    if (!KeyboardManager.AltPressed())
                    {
                        ParentScene.ClearSelected();
                        ParentScene.AddSelected(this);
                        RightClick(gameTime);
                        ParentLevel.ModifyWindows();
                    }
                    else
                    {
                        Destroy();
                    }

                    return(true);
                }
            }
            return(false);
        }