/*--------------------------------------------------------------------------------------------*/ private void UpdateIndicator(IHoverCursorData pCursorData) { if ( !Application.isPlaying ) { return; } HoverIndicator idleInd = IdleRenderer.GetComponent<HoverIndicator>(); idleInd.Controllers.Set(HoverIndicator.HighlightProgressName, this); idleInd.HighlightProgress = pCursorData.Idle.Progress; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void UpdatePosition(IHoverCursorData pCursorData) { IdleRenderer.Controllers.Set(HoverRendererIdle.CenterPositionName, this); IdleRenderer.Controllers.Set(HoverRendererIdle.DistanceThresholdName, this); IdleRenderer.CenterPosition = transform.InverseTransformPoint(pCursorData.Idle.WorldPosition); IdleRenderer.DistanceThreshold = pCursorData.Idle.DistanceThreshold; /*Transform itemPointHold = IdleRenderer.Fill.ItemPointer.transform.parent; Transform cursPointHold = IdleRenderer.Fill.CursorPointer.transform.parent; IdleRenderer.Controllers.Set(SettingsControllerMap.GameObjectActiveSelf, this); RendererUtil.SetActiveWithUpdate(IdleRenderer.gameObject, (!Application.isPlaying || currRec != null)); if ( currRec == null ) { if ( Application.isPlaying ) { return; } cursor = FindObjectOfType<HoverCursorDataProvider>() .GetCursorData(CursorType.RightIndex); } else { cursor = currRec.Value.NearestHighlight.Cursor; }*/ /*IdleRenderer.Controllers.Set(SettingsControllerMap.TransformPosition, this); IdleRenderer.transform.position = pCursorData.Idle.WorldPosition; //+pCursorData.WorldRotation*(Vector3.up*pCursorData.Size*1.5f); //IdleRenderer.transform.rotation = // Quaternion.Slerp(pCursorData.WorldRotation, transform.rotation, RotationLerp); /*Vector3 itemCenter = GetComponent<HoverRendererUpdater>() .ActiveRenderer.GetCenterWorldPosition(); Vector3 itemCenterLocalPos = IdleRenderer.transform .InverseTransformPoint(itemCenter); Vector3 cursorLocalPos = IdleRenderer.transform .InverseTransformPoint(pCursorData.WorldPosition); itemPointHold.localRotation = Quaternion.FromToRotation(Vector3.right, itemCenterLocalPos); cursPointHold.localRotation = Quaternion.FromToRotation(Vector3.right, cursorLocalPos);*/ }
/*--------------------------------------------------------------------------------------------*/ private Highlight CalculateHighlight(IHoverCursorData pCursor) { var high = new Highlight(); high.Cursor = pCursor; if ( !Application.isPlaying ) { return high; } high.NearestWorldPos = ProximityProvider.GetNearestWorldPosition(pCursor.WorldPosition); high.Distance = (pCursor.WorldPosition-high.NearestWorldPos).magnitude; high.Progress = Mathf.InverseLerp(InteractionSettings.HighlightDistanceMax, InteractionSettings.HighlightDistanceMin, high.Distance); return high; }
/*--------------------------------------------------------------------------------------------*/ private Highlight CalculateHighlight(IHoverCursorData pCursor) { var high = new Highlight(); high.Cursor = pCursor; if ( !Application.isPlaying ) { return high; } Vector3 useCursorPos = pCursor.WorldPosition; if ( pCursor.IsRaycast ) { var worldRay = new Ray(pCursor.WorldPosition, pCursor.WorldRotation*pCursor.RaycastLocalDirection); RaycastResult raycast; high.NearestWorldPos = ProximityProvider.GetNearestWorldPosition(worldRay, out raycast); high.RaycastResult = raycast; useCursorPos = raycast.WorldPosition; Debug.DrawLine(worldRay.origin, useCursorPos, Color.cyan); } else { high.NearestWorldPos = ProximityProvider.GetNearestWorldPosition(pCursor.WorldPosition); high.RaycastResult = null; } high.Distance = (useCursorPos-high.NearestWorldPos).magnitude; high.Progress = Mathf.InverseLerp(InteractionSettings.HighlightDistanceMax, InteractionSettings.HighlightDistanceMin, high.Distance); return high; }