void RightClick(Vector3 mousePosition) { if (clickBlock) { lrBlock = true; clickBlock = false; if (SelectedBlock) { SelectedBlock.SetSelected(false); SelectedBlock = null; } CheckLR(mousePosition); return; } Ray ray = Camera.main.ScreenPointToRay(mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, float.MaxValue, 1 << LayerMask.NameToLayer("Block"))) { Block block = hit.collider.gameObject.GetComponent <Block>(); block.SetSelected(true); SelectedBlock = block; rightBlock = true; } }
void ReleaseRight() { if (SelectedBlock != null) { SelectedBlock.SetSelected(false); SelectedBlock.ToggleCheck(); SelectedBlock = null; } rightBlock = false; }
void MoveRight(Vector3 mousePosition) { if (rightBlock) { if (SelectedBlock != null) { SelectedBlock.SetSelected(false); SelectedBlock = null; } Ray ray = Camera.main.ScreenPointToRay(mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, float.MaxValue, 1 << LayerMask.NameToLayer("Block"))) { Block block = hit.collider.gameObject.GetComponent <Block>(); SelectedBlock = block; block.SetSelected(true); } } }