diff --git a/Assets/GWConquest/Prefabs/Planet.prefab b/Assets/GWConquest/Prefabs/Planet.prefab index 6d32ae4..a6e641b 100644 --- a/Assets/GWConquest/Prefabs/Planet.prefab +++ b/Assets/GWConquest/Prefabs/Planet.prefab @@ -312,11 +312,13 @@ MonoBehaviour: BackgroundMusic: CameraRotatorTransform: {fileID: 7191419555384860655} planetCameraTransform: {fileID: 3266501631720423375} + PrefabObject: {fileID: 0} AdditionalObjects: {fileID: 0} RefuseConnections: 0 CircleTransform: {fileID: 9127401858082693168} CircleTransformDamp: 0.1 MaxCircleScale: 400 + FleetRestingRadius: 0.7 InTransitFormations: [] VisibilityStatus: 0 OriginalDesaturation: 0 diff --git a/Assets/GWConquest/Prefabs/UI/FleetIcon.prefab b/Assets/GWConquest/Prefabs/UI/FleetIcon.prefab index 16e3a63..a3d076b 100644 --- a/Assets/GWConquest/Prefabs/UI/FleetIcon.prefab +++ b/Assets/GWConquest/Prefabs/UI/FleetIcon.prefab @@ -502,7 +502,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264674832292904} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -606,7 +606,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264674898851119} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -645,7 +645,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &6934264674906001149 RectTransform: m_ObjectHideFlags: 0 @@ -710,7 +710,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264674906001148} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -852,7 +852,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675011364038} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -956,7 +956,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675043216174} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -1183,7 +1183,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675109408864} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -1287,7 +1287,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675160474755} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -1429,7 +1429,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675288409417} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -1533,7 +1533,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675402512296} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -1674,7 +1674,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675631535515} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -1778,7 +1778,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675738820694} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -1882,7 +1882,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675817071609} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -1986,7 +1986,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675933924743} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -2090,7 +2090,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264675955888899} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: @@ -2269,7 +2269,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &6934264676128576590 RectTransform: m_ObjectHideFlags: 0 @@ -2411,7 +2411,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6934264676454998588} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 52c162dc854d2f24fa639ba0623de5ef, type: 3} m_Name: diff --git a/Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab b/Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab index 2f178fe..49a2aed 100644 --- a/Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab +++ b/Assets/GWConquest/Prefabs/UI/PlanetIndicator.prefab @@ -265,6 +265,7 @@ GameObject: - component: {fileID: 5933915466098524944} - component: {fileID: 6518605636881664520} - component: {fileID: 3995391521375443414} + - component: {fileID: 3942724614635270031} m_Layer: 5 m_Name: BattleSwords m_TagString: Untagged @@ -330,6 +331,20 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &3942724614635270031 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1504973411824923093} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 02e6f936b2dd0634b921848bc8ca4842, type: 3} + m_Name: + m_EditorClassIdentifier: + ZoomThreshold: 400 + ConstantScale: 1 --- !u!1 &1573826406629317414 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/GWConquest/Scenes/GalaxyMap.unity b/Assets/GWConquest/Scenes/GalaxyMap.unity index 9a03cc8..9079221 100644 --- a/Assets/GWConquest/Scenes/GalaxyMap.unity +++ b/Assets/GWConquest/Scenes/GalaxyMap.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.002265214, g: 0.0024834275, b: 0.0037395754, a: 1} + m_IndirectSpecularColor: {r: 0.0058523277, g: 0.0060108704, b: 0.00798519, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -113700,6 +113700,7 @@ MonoBehaviour: maxExposure: 0.4 minColor: {r: 0.48441178, g: 0.49941182, b: 0.5294118, a: 1} maxColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1} + skyboxMaterial: {fileID: 2100000, guid: 81f714daf7144784b8a2f42f1cd30927, type: 2} --- !u!1001 &1993069155 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/GWConquest/Scripts/Formation.cs b/Assets/GWConquest/Scripts/Formation.cs index 56090c0..9239c12 100644 --- a/Assets/GWConquest/Scripts/Formation.cs +++ b/Assets/GWConquest/Scripts/Formation.cs @@ -69,6 +69,8 @@ namespace GWConquest private float animDistanceCovered = 0; + private Vector3 restingPosition; + public float AnimCompletion { get => animDistanceCovered / State.CurrentTransition.TransitionLength; } @@ -167,6 +169,8 @@ namespace GWConquest public float movingArmyScale; private GameObject movingArmyIcon; + private Vector3 arrivalPosition; + public float movementSpeed = 1f; public int FormationNumber { @@ -334,7 +338,7 @@ namespace GWConquest var iconComp = movingArmyIcon.GetComponent(); iconComp.Arrow.gameObject.SetActive(true); iconComp.UpdateDisplay(this); - iconComp.CanBeDragged = false; + iconComp.CanBeDragged = ZoneType == ZoneType.Space; var stick = movingArmyIcon.AddComponent(); stick.formation = this; @@ -356,7 +360,9 @@ namespace GWConquest IngameUI.Instance.PlanetView.SpawnLandingLine(this); } } else { - MakeMovingIcon(IngameUI.Instance.MovingFleetsTransform); + //MakeMovingIcon(IngameUI.Instance.MovingFleetsTransform); + + arrivalPosition = targetZone.planet.GetFleetArrivalPosition(originZone); } if(originZone.planet == targetZone.planet) @@ -367,7 +373,7 @@ namespace GWConquest } else { - if(movingArmyIcon != null) + if(currentZone.zoneType == ZoneType.Ground && movingArmyIcon != null) { Destroy(movingArmyIcon); movingArmyIcon = null; @@ -378,6 +384,8 @@ namespace GWConquest { planet.InTransitFormations.Remove(this); } + + } @@ -407,6 +415,12 @@ namespace GWConquest { currentZone = Zone.GetFromId(State.CurrentTransition.TargetZone); + + if(currentZone.zoneType == ZoneType.Space) + { + State.FleetRestingPoint = currentZone.planet.GetFleetArrivalPosition(Zone.GetFromId(State.CurrentTransition.OriginZone)); + } + State.CurrentTransition.OriginZone = -1; State.CurrentTransition.TargetZone = -1; State.CurrentTransition.TransitionLength = 0; @@ -500,7 +514,13 @@ namespace GWConquest private void Update() { - + if(GameManager.EntitiesLoaded) + { + if(currentZone != null && currentZone.zoneType == ZoneType.Space && movingArmyIcon == null) + { + MakeMovingIcon(IngameUI.Instance.MovingFleetsTransform); + } + } //Debug.LogFormat("Current state: IsInTransit {0}; CurrentZone {1}; CoveredDistance {2}", State.IsInTransit, State.CurrentZone, CoveredDistance); if (MovementState == FormationMovementState.Moving) @@ -508,6 +528,17 @@ namespace GWConquest animDistanceCovered += movementSpeed * Time.deltaTime; Zone originZone = Zone.GetFromId(State.CurrentTransition.OriginZone); Zone targetZone = Zone.GetFromId(State.CurrentTransition.TargetZone); + + Vector3 originPos = originZone.transform.position; + Vector3 targetPos = targetZone.transform.position; + + if(!State.CurrentTransition.IsCurved) + { + originPos += originZone.planet.GetFleetArrivalPosition(targetZone) * originZone.planet.GetCurrentCircleRadius(); + targetPos += targetZone.planet.GetFleetArrivalPosition(originZone) * targetZone.planet.GetCurrentCircleRadius(); + + } + Vector3 oldPos = transform.position; Vector3 newPos; Quaternion newRot; @@ -525,8 +556,8 @@ namespace GWConquest //} //else //{ - newPos = Vector3.Lerp(originZone.transform.position, - targetZone.transform.position, + newPos = Vector3.Lerp(originPos, + targetPos, animDistanceCovered / State.CurrentTransition.TransitionLength); newRot = Quaternion.LookRotation(newPos - oldPos, Vector3.up); //} @@ -535,10 +566,67 @@ namespace GWConquest transform.rotation = newRot; } - else if(currentZone != null) + else if(MovementState == FormationMovementState.PreparingMovement) { - transform.position = currentZone.transform.position; + if(ZoneType == ZoneType.Space) + { + var planet = currentZone.planet; + Vector3 origin = GetRestingPosition(); + var targetZone = PathQueue.First(); + Vector3 target = planet.transform.position + planet.GetFleetArrivalPosition(targetZone) * planet.GetCurrentCircleRadius(); + + Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); + transform.position = newPos; + } + } + else if(MovementState == FormationMovementState.FinishingMovement) + { + if(ZoneType == ZoneType.Space) + { + var planet = currentZone.planet; + Vector3 target = GetRestingPosition(); + Vector3 origin = planet.transform.position + arrivalPosition * planet.GetCurrentCircleRadius(); + + Vector3 newPos = Vector3.Lerp(origin, target, 1f - ActionCooldownPercent); + transform.position = newPos; + } + + } + else if(MovementState == FormationMovementState.Idle) + { + //transform.position = currentZone.transform.position; + if(ZoneType == ZoneType.Space) + { + transform.position = GetRestingPosition(); + } + else { + transform.position = currentZone.transform.position; + } + } + + if(movingArmyIcon != null && ZoneType == ZoneType.Space) + { + if(GameManager.Instance.ShowCircles || MovementState == FormationMovementState.Moving) + { + movingArmyIcon.SetActive(true); + movingArmyIcon.GetComponent().Update(); + } + else { + movingArmyIcon.SetActive(false); + } + } + } + + private Vector3 GetRestingPosition() + { + if(currentZone == null) + return Vector3.zero; + + var planet = currentZone.planet; + float currentCircleRadius = planet.GetCurrentCircleRadius(); + + return planet.transform.position + State.FleetRestingPoint * 0.5f * currentCircleRadius; } public override void Attached() diff --git a/Assets/GWConquest/Scripts/Planet.cs b/Assets/GWConquest/Scripts/Planet.cs index e01f303..33c57d3 100644 --- a/Assets/GWConquest/Scripts/Planet.cs +++ b/Assets/GWConquest/Scripts/Planet.cs @@ -59,6 +59,8 @@ namespace GWConquest public float CircleTransformDamp; public float MaxCircleScale; private float CircleScaleVelocity; + + public float FleetRestingRadius; public PlanetData PlanetData @@ -509,6 +511,31 @@ namespace GWConquest } } + public Vector3 GetFleetRestingPosition(Zone origin=null) + { + Vector3 dir; + if(origin == null) + { + dir = Vector3.right; + } + else { + dir = (origin.transform.position - transform.position).normalized; + } + + return dir * FleetRestingRadius; + } + + public Vector3 GetFleetArrivalPosition(Zone origin) + { + Vector3 dir = (origin.transform.position - transform.position).normalized; + return dir; + } + + public float GetCurrentCircleRadius() + { + return CircleTransform.lossyScale.x * 0.5f; + } + #if UNITY_EDITOR diff --git a/Assets/GWConquest/Scripts/UI/FormationIcon.cs b/Assets/GWConquest/Scripts/UI/FormationIcon.cs index 57ac966..d44cbfd 100644 --- a/Assets/GWConquest/Scripts/UI/FormationIcon.cs +++ b/Assets/GWConquest/Scripts/UI/FormationIcon.cs @@ -99,9 +99,24 @@ namespace GWConquest { } } + var stick = GetComponent(); + if(stick != null) + { + stick.enabled = true; + } + return true; } + public override void OnDragBegin() + { + var stick = GetComponent(); + if(stick != null) + { + stick.enabled = false; + } + } + public override bool CanDrag() { return CanBeDragged; diff --git a/Assets/GWConquest/Scripts/UI/StickToFormation.cs b/Assets/GWConquest/Scripts/UI/StickToFormation.cs index a0dc501..d481de1 100644 --- a/Assets/GWConquest/Scripts/UI/StickToFormation.cs +++ b/Assets/GWConquest/Scripts/UI/StickToFormation.cs @@ -9,9 +9,9 @@ namespace GWConquest { public Formation formation; - private void Update() { - if(formation.MovementState == FormationMovementState.Moving) - { + public void Update() { + //if(formation.MovementState == FormationMovementState.Moving) + //{ Vector3 dir; if(formation.State.CurrentTransition.IsCurved) { @@ -57,7 +57,7 @@ namespace GWConquest { formationIcon.Arrow.localRotation = Quaternion.FromToRotation(Vector3.up, dir); } - } + //} } } } diff --git a/Assets/GWConquest/Scripts/UI/UIZoomScaling.cs b/Assets/GWConquest/Scripts/UI/UIZoomScaling.cs index f096d1e..56efc57 100644 --- a/Assets/GWConquest/Scripts/UI/UIZoomScaling.cs +++ b/Assets/GWConquest/Scripts/UI/UIZoomScaling.cs @@ -47,7 +47,7 @@ namespace GWConquest { void OnDisable() { - GWCamera.Instance.RemoveZoomScaling(this); + GWCamera.Instance?.RemoveZoomScaling(this); } } diff --git a/Assets/GWConquest/Scripts/Unit.cs b/Assets/GWConquest/Scripts/Unit.cs index b5109f8..c3c6f28 100644 --- a/Assets/GWConquest/Scripts/Unit.cs +++ b/Assets/GWConquest/Scripts/Unit.cs @@ -228,6 +228,12 @@ namespace GWConquest playerFormation.Player = player; playerFormation.currentZone = zone; playerFormation.ZoneType = uc.ZoneType; + + if(playerFormation.ZoneType == ZoneType.Space) + { + Vector3 startPos = zone.planet.GetFleetRestingPosition(); + playerFormation.State.FleetRestingPoint = startPos; + } } BoltEntity unitEntity = BoltNetwork.Instantiate(BoltPrefabs.Unit); diff --git a/Assets/GWConquest/Scripts/ZoomSkyboxEffect.cs b/Assets/GWConquest/Scripts/ZoomSkyboxEffect.cs index 38fe7af..31400f3 100644 --- a/Assets/GWConquest/Scripts/ZoomSkyboxEffect.cs +++ b/Assets/GWConquest/Scripts/ZoomSkyboxEffect.cs @@ -13,6 +13,13 @@ namespace GWConquest public Color minColor; public Color maxColor; + public Material skyboxMaterial; + + void Start() + { + RenderSettings.skybox = new Material(skyboxMaterial); + } + void Update() { float percent = Mathf.InverseLerp(GWCamera.Instance.minCameraZoom, GWCamera.Instance.maxCameraZoom, Camera.main.orthographicSize); diff --git a/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll b/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll index c55d52e..b55ce34 100644 Binary files a/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll and b/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll differ diff --git a/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb b/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb index 39ccbb4..aaeeb75 100644 Binary files a/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb and b/Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb differ diff --git a/Assets/Photon/PhotonBolt/project.json b/Assets/Photon/PhotonBolt/project.json index 64b7b98..5965536 100644 --- a/Assets/Photon/PhotonBolt/project.json +++ b/Assets/Photon/PhotonBolt/project.json @@ -385,6 +385,53 @@ "ExtrapolationMaxFrames": 9, "SnapMagnitude": 10.0 } + }, + { + "Name": "FleetRestingPoint", + "Enabled": true, + "Expanded": true, + "ReplicationMode": 1, + "Priority": 1, + "PropertyType": { + "$type": "Photon.Bolt.Compiler.PropertyTypeVector, bolt.compiler", + "Selection": 10, + "Compression": [ + { + "MinValue": -1024, + "MaxValue": 1024, + "Accuracy": 0.01, + "Pack": 100.0, + "Read": 0.01, + "Shift": 1024.0, + "BitsRequired": 18 + }, + { + "MinValue": -1024, + "MaxValue": 1024, + "Accuracy": 0.01, + "Pack": 100.0, + "Read": 0.01, + "Shift": 1024.0, + "BitsRequired": 18 + }, + { + "MinValue": -1024, + "MaxValue": 1024, + "Accuracy": 0.01, + "Pack": 100.0, + "Read": 0.01, + "Shift": 1024.0, + "BitsRequired": 18 + } + ] + }, + "AssetSettings": { + "$type": "Photon.Bolt.Compiler.PropertyStateSettings, bolt.compiler", + "ExtrapolationErrorTolerance": 0.25, + "_ExtrapolationCorrectionFrames": 6, + "ExtrapolationMaxFrames": 9, + "SnapMagnitude": 10.0 + } } ], "PacketMaxBits": 512,