void UpdateMinimapElement(HUDNavigationElement element, Vector3 screenPos, float distance) { // check if element is hidden within the minimap if (element.hideInMinimap) { element.SetMarkerActive(NavigationElementType.Minimap, false); return; } // check distance if (distance > minimapRadius) { // invoke events if (element.IsInMinimapRadius) { element.IsInMinimapRadius = false; element.OnLeaveRadius.Invoke(element, NavigationElementType.Minimap); } // hide element if (!element.ignoreMinimapRadius) { element.SetMarkerActive(NavigationElementType.Minimap, false); return; } } else { // invoke events if (!element.IsInMinimapRadius) { element.IsInMinimapRadius = true; element.OnEnterRadius.Invoke(element, NavigationElementType.Minimap); } } // rotate marker within minimap with gameobject? if (element.rotateWithGameObjectMM) { element.Minimap.Icon.transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, -element.transform.eulerAngles.y)); } else { element.Minimap.Icon.transform.rotation = Quaternion.identity; } // set marker active element.SetMarkerActive(NavigationElementType.Minimap, true); // calculate marker position Vector2 unitScale = minimapProfile.GetMapUnitScale(); Vector3 posOffset = element.GetPositionOffset(PlayerController.position); //修改 小地图“食物”移动逻辑 //Vector3 markerPos = new Vector3 (posOffset.x * unitScale.x, posOffset.z * unitScale.y, 0f) * minimapScale; /// //Start Vector3 markerPos = new Vector3(posOffset.x * unitScale.x, posOffset.y * unitScale.x, 0f) * minimapScale; //end // adjust marker position when using minimap rotation mode if (minimapMode == MinimapModes.RotateMinimap) { markerPos = PlayerController.MinimapRotationOffset(markerPos); } // always keep marker within minimap rect bool outOfBounds = false; markerPos = _HUDNavigationCanvas.Minimap.ElementContainer.KeepInRectBounds(markerPos, out outOfBounds); // set marker position element.SetMarkerPosition(NavigationElementType.Minimap, markerPos); // handle marker's above/below arrows element.ShowMinimapAboveArrow(useMinimapHeightSystem && element.useMinimapHeightSystem && !outOfBounds && -posOffset.y < -minimapDistanceAbove); element.ShowMinimapBelowArrow(useMinimapHeightSystem && element.useMinimapHeightSystem && !outOfBounds && -posOffset.y > minimapDistanceBelow); }