in SupportingScripts/Runtime/Scripts/MapRenderer/Interaction/MapInteractionController.cs [84:124]
private void Update()
{
const float rotationAngle = 45.0f;
// Update rotation, if needed.
var currentMapRotation = _mapRenderer.transform.localRotation.eulerAngles.y;
if (_activeRotationDirection == 0 && _rotationDirectionStack.Any())
{
_activeRotationDirection = _rotationDirectionStack.Pop();
_targetRotation = rotationAngle * Mathf.Round((currentMapRotation / rotationAngle) + _activeRotationDirection);
//Debug.Log(currentMapRotation + ", " + _activeRotationDirection + ", " + _targetRotation);
_targetRotation = _targetRotation < 0.0f ? (float)FMod(_targetRotation, 360.0f) : _targetRotation;
}
if (_activeRotationDirection != 0 && _targetRotation != currentMapRotation)
{
currentMapRotation = _activeRotationDirection < 0 && currentMapRotation == 0.0f ? 360.0f : currentMapRotation;
var newRotation = currentMapRotation + rotationAngle * _activeRotationDirection * Time.deltaTime * _rotationSpeed;
// Check if we are done. If so, reset active and target rotation to 0.
var isComplete = false;
if (_activeRotationDirection < 0)
{
isComplete = newRotation <= _targetRotation;
}
else if (_activeRotationDirection > 0)
{
isComplete = newRotation >= _targetRotation;
}
if (isComplete)
{
newRotation = _targetRotation == 360.0f ? 0.0f : _targetRotation;
_activeRotationDirection = 0;
_targetRotation = 0;
}
_mapRenderer.transform.localRotation =
Quaternion.Euler(_mapRenderer.transform.localRotation.eulerAngles.x, newRotation, _mapRenderer.transform.localRotation.eulerAngles.z);
}
}