diff --git a/Assets/Materials/Brushes/Wormhole Waves.mat b/Assets/Materials/Brushes/Wormhole Waves.mat index cbe3e86e7..12ea978a7 100644 --- a/Assets/Materials/Brushes/Wormhole Waves.mat +++ b/Assets/Materials/Brushes/Wormhole Waves.mat @@ -74,7 +74,7 @@ Material: - _SinePower: 1.25 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - - _Speed: 10 + - _Speed: 20 - _SrcBlend: 1 - _UVSec: 0 - _ZWrite: 1 diff --git a/Assets/Materials/UI/Map Gravity Lines.mat b/Assets/Materials/UI/Map Gravity Lines.mat index 4701ebcc6..913368cbf 100644 --- a/Assets/Materials/UI/Map Gravity Lines.mat +++ b/Assets/Materials/UI/Map Gravity Lines.mat @@ -86,7 +86,7 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 - - _Scale: 5.9919047 + - _Scale: 5.396003 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 diff --git a/Assets/Scenes/ARPG.unity b/Assets/Scenes/ARPG.unity index edc4e04e5..136c0ff61 100644 --- a/Assets/Scenes/ARPG.unity +++ b/Assets/Scenes/ARPG.unity @@ -18033,7 +18033,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.x - value: 55.675 + value: 0 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -18964,7 +18964,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.x - value: 60.98 + value: 0 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index f8a9c982e..8be70f818 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -98,7 +98,16 @@ public class ActionGameManager : MonoBehaviour Zone = new Zone(Settings.PlanetSettings, zonePack); Zone.Log = s => Debug.Log($"Zone: {s}"); + + if (CurrentShip != null) + { + Zone.Entities.Add(CurrentShip); + } + SectorRenderer.LoadZone(Zone); + + if (CurrentShip != null) + BindToEntity(); } void Start() @@ -204,6 +213,7 @@ public class ActionGameManager : MonoBehaviour GenerateLevel(); CurrentShip.ExitWormhole(SectorRenderer.WormholeInstances.Keys.First().Position, Settings.GameplaySettings.WormholeExitVelocity * ItemManager.Random.NextFloat2Direction()); + CurrentShip.Zone = Zone; }; } } @@ -215,6 +225,8 @@ public class ActionGameManager : MonoBehaviour AkSoundEngine.PostEvent(CurrentShip.HeatsinksEnabled ? "UI_Success" : "UI_Fail", gameObject); }; + #region Targeting + _input.Player.TargetReticle.performed += context => { var underReticle = Zone.Entities.Where(x => x != CurrentShip) @@ -241,6 +253,9 @@ public class ActionGameManager : MonoBehaviour var currentTargetIndex = Array.IndexOf(targets, CurrentShip.Target.Value); CurrentShip.Target.Value = targets[(currentTargetIndex + targets.Length - 1) % targets.Length]; }; + + #endregion + #region Trigger Groups @@ -505,32 +520,14 @@ public class ActionGameManager : MonoBehaviour } else if (CurrentShip.Parent.TryUndock(CurrentShip)) { - SectorRenderer.PerspectiveEntity = CurrentShip; Menu.gameObject.SetActive(false); DockedEntity = null; DockingBay = null; //_shipInput = new ShipInput(_input.Player, _currentShip); DockCamera.enabled = false; FollowCamera.enabled = true; - FollowCamera.LookAt = SectorRenderer.EntityInstances[CurrentShip].LookAtPoint; - FollowCamera.Follow = SectorRenderer.EntityInstances[CurrentShip].transform; - _articulationGroups = CurrentShip.Equipment - .Where(item => item.Behaviors.Any(x => x.Data is WeaponData && !(x.Data is LauncherData))) - .GroupBy(item => SectorRenderer.EntityInstances[CurrentShip] - .GetBarrel(CurrentShip.Hardpoints[item.Position.x, item.Position.y]) - .GetComponentInParent()?.Group ?? -1) - .Select((group, index) => { - return ( - group.Select(item => CurrentShip.Hardpoints[item.Position.x, item.Position.y]).ToArray(), - group.Select(item => SectorRenderer.EntityInstances[CurrentShip].GetBarrel(CurrentShip.Hardpoints[item.Position.x, item.Position.y])).ToArray(), - Crosshairs[index] - ); - }).ToArray(); - - foreach (var crosshair in Crosshairs) - crosshair.gameObject.SetActive(false); - foreach (var group in _articulationGroups) - group.crosshair.gameObject.SetActive(true); + + BindToEntity(); _lockingIndicators = CurrentShip.GetBehaviors() .Select(x => @@ -571,6 +568,31 @@ public class ActionGameManager : MonoBehaviour } } + private void BindToEntity() + { + SectorRenderer.PerspectiveEntity = CurrentShip; + + FollowCamera.LookAt = SectorRenderer.EntityInstances[CurrentShip].LookAtPoint; + FollowCamera.Follow = SectorRenderer.EntityInstances[CurrentShip].transform; + _articulationGroups = CurrentShip.Equipment + .Where(item => item.Behaviors.Any(x => x.Data is WeaponData && !(x.Data is LauncherData))) + .GroupBy(item => SectorRenderer.EntityInstances[CurrentShip] + .GetBarrel(CurrentShip.Hardpoints[item.Position.x, item.Position.y]) + .GetComponentInParent()?.Group ?? -1) + .Select((group, index) => { + return ( + group.Select(item => CurrentShip.Hardpoints[item.Position.x, item.Position.y]).ToArray(), + group.Select(item => SectorRenderer.EntityInstances[CurrentShip].GetBarrel(CurrentShip.Hardpoints[item.Position.x, item.Position.y])).ToArray(), + Crosshairs[index] + ); + }).ToArray(); + + foreach (var crosshair in Crosshairs) + crosshair.gameObject.SetActive(false); + foreach (var group in _articulationGroups) + group.crosshair.gameObject.SetActive(true); + } + public void SaveZone() => File.WriteAllBytes( Path.Combine(_filePath.FullName, $"{Zone.Data.Name}.zone"), MessagePackSerializer.Serialize(Zone.Pack())); diff --git a/Assets/Scripts/Sector Display/SectorRenderer.cs b/Assets/Scripts/Sector Display/SectorRenderer.cs index dc5af1c9d..87dac7279 100644 --- a/Assets/Scripts/Sector Display/SectorRenderer.cs +++ b/Assets/Scripts/Sector Display/SectorRenderer.cs @@ -148,10 +148,10 @@ public class SectorRenderer : MonoBehaviour public void LoadZone(Zone zone) { + ClearZone(); _maxDepth = 0; Zone = zone; SectorBrushes.localScale = zone.Data.Radius * 2 * Vector3.one; - ClearZone(); foreach(var p in zone.Planets.Values) LoadPlanet(p); @@ -204,8 +204,14 @@ public class SectorRenderer : MonoBehaviour public void ClearZone() { + if (Zone == null) return; foreach (var wormhole in WormholeInstances.Values) Destroy(wormhole); WormholeInstances.Clear(); + + foreach (var entity in Zone.Entities) + { + UnloadEntity(entity); + } if (Planets.Count > 0) { @@ -214,10 +220,10 @@ public class SectorRenderer : MonoBehaviour DestroyImmediate(planet.gameObject); } Planets.Clear(); - // foreach (var beltObject in _beltObjects.Values) - // { - // beltObject. - // } + foreach (var beltObject in _beltObjects.Values) + { + Destroy(beltObject.Filter); + } _beltObjects.Clear(); _beltMeshes.Clear(); _beltMatrices.Clear(); @@ -446,7 +452,7 @@ public class InstancedMesh public class AsteroidBeltUI { - private MeshFilter _filter; + public MeshFilter Filter; private MeshCollider _collider; private Vector3[] _vertices; private Vector3[] _normals; @@ -463,7 +469,7 @@ public class AsteroidBeltUI { _belt = belt; _zone = zone; - _filter = meshFilter; + Filter = meshFilter; _collider = collider; var orbit = zone.Orbits[belt.Data.Orbit]; _orbitParent = orbit.Data.Parent; @@ -509,7 +515,7 @@ public class AsteroidBeltUI _mesh.bounds = new Bounds(Vector3.zero, Vector3.one * maxDist); _size = maxDist; - _filter.mesh = _mesh; + Filter.mesh = _mesh; //_collider.sharedMesh = _mesh; } diff --git a/Assets/Scripts/ServerShared/Ship.cs b/Assets/Scripts/ServerShared/Ship.cs index 80793afa4..479d296df 100644 --- a/Assets/Scripts/ServerShared/Ship.cs +++ b/Assets/Scripts/ServerShared/Ship.cs @@ -222,7 +222,7 @@ public class Ship : Entity public override void Update(float delta) { - if (_active && !_exitingWormhole) + if (_active && !_exitingWormhole && !_enteringWormhole) { foreach (var thruster in _allThrusters) thruster.Axis = 0; var rightThrusterTorqueCompensation = abs(RightStrafeTotalTorque) / RightStrafeTorqueThrusters.Length; @@ -287,8 +287,8 @@ public class Ship : Entity } else { - var exitLerp = _wormholeAnimationProgress - ItemManager.GameplaySettings.WormholeExitCurveStart / - (1 - ItemManager.GameplaySettings.WormholeExitCurveStart); + var exitLerp = (_wormholeAnimationProgress - ItemManager.GameplaySettings.WormholeExitCurveStart) / + (1 - ItemManager.GameplaySettings.WormholeExitCurveStart); exitLerp *= exitLerp; // Square the interpolation variable to produce curve with zero slope at start Position.xz = _wormholePosition + normalize(_wormholeExitVelocity) * exitLerp * ItemManager.GameplaySettings.WormholeExitRadius; Rotation = quaternion.LookRotation( diff --git a/Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset b/Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset index 91fa052a8..2bf4d89f3 100644 --- a/Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset +++ b/Assets/Wwise/Editor/ProjectData/AkWwiseProjectData.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:74c8ed162ea8f2e83890fe4f06a1394cfb17d0e96f1553d51a606069b3d3e854 -size 6447 +oid sha256:16d3006f339f3e426d16b874251975385de72386a72fde5587a2ce631af96714 +size 6387 diff --git a/Economy.Shared.Unity.csproj b/Economy.Shared.Unity.csproj index fa7f1787d..b67ad3fbd 100644 --- a/Economy.Shared.Unity.csproj +++ b/Economy.Shared.Unity.csproj @@ -126,6 +126,7 @@ + @@ -524,7 +525,6 @@ -