void TriggerInitializeBoard(UIPlane plane) { // don't do anything on a single click if (plane.extent.magnitude < 0.1f) { return; } // get the rotation of our plane Quaternion rotation = new Quaternion(0f, Camera.main.transform.rotation.y, 0f, 1f); // trigger an initializeBoard event with our center and extent // pack the values pertaining to a plane into a container to publish with our InitializeBoard msg UpdatePlane(plane.start, plane.end, 300f); UIInput.InitBoard(new UIPlane(start: plane.start, end: plane.end, rotation: rotation)); }
// Update is called once per frame void Update() { if (WARGame.Mode.Value.current == GAME_MODE.setup) { // save our click start position if (Input.GetMouseButtonDown(0)) { mouseClickStart = Input.mousePosition; } if (Input.GetMouseButtonUp(0)) { // TODO use this layer mask to figure out if we are hitting a tile or not when we click Vector2 mouseClickEnd = Input.mousePosition; TriggerInitializeBoard(FindPlaneExtent()); } // while the mouse is down, draw a plane to represent the drag if (Input.GetMouseButton(0)) { UIPlane plane = FindPlaneExtent(); UpdatePlane(plane.start, plane.end); } DrawPlane(); } }
public static void InitBoard(UIPlane plane) { control.onBoardInit(plane); }
public static void InitBoard(UIPlane plane) { UIInput.Instance.onBoardInit(plane); }