diff --git a/Assets/GWConquest/Scenes/GalaxyMap.unity b/Assets/GWConquest/Scenes/GalaxyMap.unity index 6a567f9..63093e1 100644 --- a/Assets/GWConquest/Scenes/GalaxyMap.unity +++ b/Assets/GWConquest/Scenes/GalaxyMap.unity @@ -9139,6 +9139,11 @@ PrefabInstance: propertyPath: m_Materials.Array.data[0] value: objectReference: {fileID: 2100000, guid: 0df58c9d2ac0cc144a61e01af6c27f66, type: 2} + - target: {fileID: 135309575519242482, guid: 00cbbb3475b1b0640a802c21a905203b, + type: 3} + propertyPath: m_Radius + value: 34.3 + objectReference: {fileID: 0} m_RemovedComponents: - {fileID: 95714714518320300, guid: 00cbbb3475b1b0640a802c21a905203b, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 00cbbb3475b1b0640a802c21a905203b, type: 3} @@ -48383,7 +48388,7 @@ PrefabInstance: - target: {fileID: 77748483005084366, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 0.07656807 objectReference: {fileID: 0} - target: {fileID: 77748483034666527, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} @@ -105588,7 +105593,7 @@ PrefabInstance: - target: {fileID: 77748483005084366, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 0.07656807 objectReference: {fileID: 0} - target: {fileID: 77748483683952273, guid: f69b4b94559d7a14d99e0d870647c1f9, type: 3} diff --git a/Assets/GWConquest/Scripts/Formation.cs b/Assets/GWConquest/Scripts/Formation.cs index 16c37f6..2a80871 100644 --- a/Assets/GWConquest/Scripts/Formation.cs +++ b/Assets/GWConquest/Scripts/Formation.cs @@ -124,14 +124,18 @@ namespace GWConquest } } - public void MoveToZone(Zone target, float lengthFactor = 1f) + public void MoveToZone(Zone target) { if(entity.IsOwner && !state.IsInTransit) { state.CurrentTransition.OriginZone = Zone.GetZoneId(currentZone); state.CurrentTransition.TargetZone = Zone.GetZoneId(target); + bool isGroundTransition = target.zoneType == ZoneType.Ground; + float lengthFactor = isGroundTransition ? GameManager.Instance.GroundTransitionLengthFactor : GameManager.Instance.SpaceTransitionLengthFactor; state.CurrentTransition.TransitionLength = Vector3.Distance(currentZone.transform.position, target.transform.position) * lengthFactor; + state.CurrentTransition.IsCurved = isGroundTransition; + CoveredDistance = 0; currentZone = null; state.IsInTransit = true; @@ -196,12 +200,28 @@ namespace GWConquest animDistanceCovered += movementSpeed * Time.deltaTime; Zone originZone = Zone.GetFromId(state.CurrentTransition.OriginZone); Zone targetZone = Zone.GetFromId(state.CurrentTransition.TargetZone); - Vector3 newPos = Vector3.Lerp(originZone.transform.position, - targetZone.transform.position, - animDistanceCovered / state.CurrentTransition.TransitionLength); + Vector3 oldPos = transform.position; + Vector3 newPos; + if(state.CurrentTransition.IsCurved) + { + + Vector3 planetPos = targetZone.planet.transform.position; + Vector3 originPos = originZone.transform.position - planetPos; + Vector3 targetPos = targetZone.transform.position - planetPos; + newPos = Vector3.Slerp(originPos, targetPos, + animDistanceCovered / state.CurrentTransition.TransitionLength); + newPos += planetPos; + } + else + { + newPos = Vector3.Lerp(originZone.transform.position, + targetZone.transform.position, + animDistanceCovered / state.CurrentTransition.TransitionLength); + } + transform.position = newPos; transform.rotation = Quaternion.FromToRotation(Vector3.forward, - targetZone.transform.position - originZone.transform.position); + newPos - oldPos); } else if(currentZone != null) diff --git a/Assets/GWConquest/Scripts/ServerCallbacks.cs b/Assets/GWConquest/Scripts/ServerCallbacks.cs index 137c0ba..242e84c 100644 --- a/Assets/GWConquest/Scripts/ServerCallbacks.cs +++ b/Assets/GWConquest/Scripts/ServerCallbacks.cs @@ -50,8 +50,7 @@ namespace GWConquest { Formation formation = evnt.Formation.GetComponent(); var targetZone = Zone.GetFromId(evnt.TargetZone); - var transitionLength = targetZone.zoneType == ZoneType.Ground ? GameManager.Instance.GroundTransitionLengthFactor : GameManager.Instance.SpaceTransitionLengthFactor; - formation.MoveToZone(targetZone, transitionLength); + formation.MoveToZone(targetZone); if(evnt.PathQueue != null) { var queueToken = evnt.PathQueue as BoltListToken; diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index c407e5b..579521b 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -34,7 +34,7 @@ "depth": 0, "source": "registry", "dependencies": { - "com.unity.test-framework": "1.1.3" + "com.unity.test-framework": "1.1.1" }, "url": "https://packages.unity.com" },