private void ProcessMouseButton(ClickContainer mouseClick) { // Clicked on this frame if (Input.GetMouseButtonDown((int)mouseClick.MouseButton) && mouseClick.ClickStatus == ClickContainer.CLICK_STATUS.HOVERING) { mouseClick.Click(); } // Click held down if (Input.GetMouseButton((int)mouseClick.MouseButton) && (mouseClick.ClickStatus == ClickContainer.CLICK_STATUS.DRAGGING || mouseClick.ClickStatus == ClickContainer.CLICK_STATUS.CLICKING)) { mouseClick.Drag(); } // Click released if (Input.GetMouseButtonUp((int)mouseClick.MouseButton) && (mouseClick.ClickStatus == ClickContainer.CLICK_STATUS.DRAGGING || mouseClick.ClickStatus == ClickContainer.CLICK_STATUS.CLICKING)) { mouseClick.Release(); } // Not doing anything if (!Input.GetMouseButton((int)mouseClick.MouseButton) && mouseClick.ClickStatus == ClickContainer.CLICK_STATUS.RELEASING) { mouseClick.Hover(); } }
void Start() { LeftClick = new ClickContainer(ClickContainer.MOUSE_BUTTON.LEFT); RightClick = new ClickContainer(ClickContainer.MOUSE_BUTTON.RIGHT); LeftClick.OnClickEvent += SelectPlanet; LeftClick.OnDragEvent += DragPlanet; LeftClick.OnReleaseEvent += ReleasePlanet; RightClick.OnClickEvent += StartGrabMap; RightClick.OnDragEvent += DragMap; }