diff --git a/Assets/Scenes/Test/Tools.unity b/Assets/Scenes/Test/Tools.unity index ef9e8604a..cf65d8318 100644 --- a/Assets/Scenes/Test/Tools.unity +++ b/Assets/Scenes/Test/Tools.unity @@ -26554,7 +26554,7 @@ Transform: m_GameObject: {fileID: 578159050} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: 0.0028429776, w: 0.99999595} - m_LocalPosition: {x: -0.0045670867, y: -2.9999979, z: 0} + m_LocalPosition: {x: -2.486029, y: -1.6791914, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -26962,8 +26962,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 942494481} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0.598836, w: 0.8008717} - m_LocalPosition: {x: -258.9172, y: 76.33528, z: 0} + m_LocalRotation: {x: 0, y: 0, z: -0.5786719, w: 0.81556046} + m_LocalPosition: {x: 269.24902, y: 94.2139, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -26984,8 +26984,8 @@ MonoBehaviour: m_EditorClassIdentifier: ForceLaunchAbility: 6 SwapAbility: -1 - WallClimbAbility: 0 - AirSliceAbility: 0 + WallClimbAbility: -1 + AirSliceAbility: -1 ElectricBeamAbility: -1 LongTeleportAbility: -1 --- !u!1 &1079170519 diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index 5f1f22aeb..87a34a394 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -17,7 +17,9 @@ private void Awake() Managers.initInstance(); Managers.Player.init(); Managers.Camera.init(); - Managers.PlayerPilot.init(); + FindObjectsByType(FindObjectsSortMode.None).ToList().ForEach( + pilot => pilot.init() + ); Addressables.InitializeAsync(); } diff --git a/Assets/Scripts/Managers/Managers.cs b/Assets/Scripts/Managers/Managers.cs index 8af41d617..1a1122062 100644 --- a/Assets/Scripts/Managers/Managers.cs +++ b/Assets/Scripts/Managers/Managers.cs @@ -105,7 +105,7 @@ public static MenuManager Menu public static PlayerRewindController PlayerRewind { get; private set; } //Player Pilot Controller - public static PlayerPilotController PlayerPilot { get; private set; } + public static PlayerPilotController PlayerPilot { get; set; } //Camera Controller public static CameraController Camera { get; private set; } @@ -179,7 +179,6 @@ void init() Power = FindAnyObjectByType(); Player = FindObjectsByType(FindObjectsSortMode.None).First(pc => pc.gameObject.CompareTag("Player")); PlayerRewind = FindAnyObjectByType(); - PlayerPilot = FindAnyObjectByType(); Camera = FindAnyObjectByType(); //Init with game data diff --git a/Assets/Scripts/PlayerController/Input/GestureProfile.cs b/Assets/Scripts/PlayerController/Input/GestureProfile.cs index cceab7421..cd03b68d5 100644 --- a/Assets/Scripts/PlayerController/Input/GestureProfile.cs +++ b/Assets/Scripts/PlayerController/Input/GestureProfile.cs @@ -59,7 +59,7 @@ public void processZoomLevelChange(float zoomLevel) } else if (zoomLevel > Managers.Camera.toZoomLevel(CameraController.CameraScalePoints.TIMEREWIND - 1)) { - if (CheckPointChecker.InCheckPoint) + if (CheckPointChecker.InCheckPoint && CheckPointChecker.current.GetComponentInParent()) { Managers.Gesture.switchGestureProfile(GestureManager.GestureProfileType.PILOT); } diff --git a/Assets/Scripts/PlayerController/Input/PilotGestureProfile.cs b/Assets/Scripts/PlayerController/Input/PilotGestureProfile.cs index 7fc948d10..eba2f786d 100644 --- a/Assets/Scripts/PlayerController/Input/PilotGestureProfile.cs +++ b/Assets/Scripts/PlayerController/Input/PilotGestureProfile.cs @@ -5,12 +5,20 @@ public class PilotGestureProfile : GestureProfile public override void activate() { base.activate(); - Managers.PlayerPilot.activate(true); + PlayerPilotController pilot = CheckPointChecker.current?.GetComponentInParent(); + if (pilot) + { + pilot.activate(true); + } + else + { + deactivate(); + } } public override void deactivate() { base.deactivate(); - Managers.PlayerPilot.activate(false); + CheckPointChecker.current?.GetComponentInParent()?.activate(false); } public override void processTapGesture(Vector3 curMPWorld) diff --git a/Assets/Scripts/PlayerController/PlayerPilotController.cs b/Assets/Scripts/PlayerController/PlayerPilotController.cs index 9540560aa..91822d4b4 100644 --- a/Assets/Scripts/PlayerController/PlayerPilotController.cs +++ b/Assets/Scripts/PlayerController/PlayerPilotController.cs @@ -29,12 +29,17 @@ public void activate(bool active) { Managers.Player.Teleport.Range = playerController.Teleport.Range; checkPointChecker?.clearPostTeleport(true); + Managers.PlayerPilot = this; } else { Managers.Player.Teleport.Range = Managers.Player.Teleport.baseRange; CheckPointChecker.current = null;//dirty: the checkpoint system should handle this better checkPointChecker?.trigger(); + if (Managers.PlayerPilot == this) + { + Managers.PlayerPilot = null; + } } }