void Button_Down(object sender, Duality.Input.MouseButtonEventArgs e)
 {
     // did I click the left button and am I hovering a component? do something!
     if (e.Button == Duality.Input.MouseButton.Left && currentComponent != null)
     {
         currentComponent.DoAction();
     }
 }
		void ICmpUpdatable.OnUpdate()
		{
			// No menus currently active? Switch to StartingMenu - this is checked everytime
			if (this.currentMenu == null)
			{
				this.SwitchToMenu(this.StartingMenu);
			}

			mousePosition.X = DualityApp.Mouse.X;
			mousePosition.Y = DualityApp.Mouse.Y;

			// check all MenuComponents under the mouse and sort them by Z,
			// to find the one nearest to the Camera
			MenuComponent hoveredComponent = this.GameObj.ParentScene.FindComponents<MenuComponent>()
				.Where(mc => mc.GameObj.Active && mc.GetAreaOnScreen().Contains(mousePosition))
				.OrderBy(mc => mc.GameObj.Transform.Pos.Z)
				.FirstOrDefault();

			// I found my hovered menu component.. is it different from the current one?
			if (hoveredComponent != currentComponent)
			{
				// if the old one is not null, leave it.
				if (currentComponent != null)
				{
					currentComponent.MouseLeave();
				}

				// if the new one is not null, enter it.
				if (hoveredComponent != null)
				{
					hoveredComponent.MouseEnter();
				}
			}


			// set the current component to the hovered one.
			currentComponent = hoveredComponent;

			// did I click the left button and am I hovering a component? do something!
			if (DualityApp.Mouse.ButtonHit(Duality.Input.MouseButton.Left) && currentComponent != null)
			{
				currentComponent.DoAction();
			}
		}
        void ICmpUpdatable.OnUpdate()
        {
            // No menus currently active? Switch to StartingMenu - this is checked everytime
            if (this.currentMenu == null)
            {
                this.SwitchToMenu(this.StartingMenu);
            }

            mousePosition.X = DualityApp.Mouse.X;
            mousePosition.Y = DualityApp.Mouse.Y;

            // check all MenuComponents under the mouse and sort them by Z,
            // to find the one nearest to the Camera
            MenuComponent hoveredComponent = this.GameObj.ParentScene.FindComponents <MenuComponent>()
                                             .Where(mc => mc.GameObj.Active && mc.GetAreaOnScreen().Contains(mousePosition))
                                             .OrderBy(mc => mc.GameObj.Transform.Pos.Z)
                                             .FirstOrDefault();

            // I found my hovered menu component.. is it different from the current one?
            if (hoveredComponent != currentComponent)
            {
                // if the old one is not null, leave it.
                if (currentComponent != null)
                {
                    currentComponent.MouseLeave();
                }

                // if the new one is not null, enter it.
                if (hoveredComponent != null)
                {
                    hoveredComponent.MouseEnter();
                }
            }


            // set the current component to the hovered one.
            currentComponent = hoveredComponent;

            // did I click the left button and am I hovering a component? do something!
            if (DualityApp.Mouse.ButtonHit(Duality.Input.MouseButton.Left) && currentComponent != null)
            {
                currentComponent.DoAction();
            }
        }