示例#1
0
        private void Mouse_ButtonDown(object sender, Duality.Input.MouseButtonEventArgs e)
        {
            if (DualityApp.Mouse.ButtonPressed(Duality.Input.MouseButton.Left))
            {
                Camera cam = GameObj.GetComponent <Camera>();

                cam.RenderPickingMap(new Point2(DualityApp.UserData.GfxWidth, DualityApp.UserData.GfxHeight), false);
                ICmpRenderer clicked = cam.PickRendererAt(DualityApp.Mouse.X, DualityApp.Mouse.Y);
                if (clicked != null && clicked is SpriteRenderer)
                {
                    SpriteRenderer r         = clicked as SpriteRenderer;
                    IClickable     clickable = r.GameObj.GetComponent <IClickable>();
                    if (clickable != null)
                    {
                        clickable.RespondToClick(MouseArgs.LeftButton);
                    }
                }
            }
        }