void UpdateDetectModeStart() { if (Input.GetMouseButtonDown(BUTTON_LEFTMOUSE)) // LMB was pressed down this frame { } else if (Input.GetMouseButtonUp(BUTTON_LEFTMOUSE)) { //are we click on a tile with a unit? //Debug.Log("left click"); actionController.Select(hexUnderMouse); } else if (Input.GetMouseButton(BUTTON_LEFTMOUSE) && Input.mousePosition != lastMousePos) // LMB is being held down // LMB held down and mouse moved -- camera drag { lastMouseGroundPlanePos = MouseToGroundPlane(Input.mousePosition); update_CurrentFunc = UpdateClickAndDrag; update_CurrentFunc(); } else if (actionController.GetSelectedUnit() != null && Input.GetMouseButton(BUTTON_RIGHTMOUSE)) { //right clicked somewhere -- tell action controller update_CurrentFunc = UpdateUnitMovement; } else if (Input.GetMouseButton(BUTTON_RIGHTMOUSE)) { actionController.ExitZonePlacementMode(); } }
// Start is called before the first frame update void Start() { update_CurrentFunc = UpdateDetectModeStart; hexMap = GameObject.FindObjectOfType <HexMap>(); uiController = FindObjectOfType <UIController>(); actionController = FindObjectOfType <ActionController>(); }
private void CancelUpdateFunc() { update_CurrentFunc = UpdateDetectModeStart; hexPath = null; //clean up any UI stuff associated with modes }
VxArgs.NotNull(updateFunc, nameof(updateFunc));