From 0ef78f3eb53eeab2b041815a63221f6c8c2ffdee Mon Sep 17 00:00:00 2001 From: Melbyj1125 <60886701+Melbyj1125@users.noreply.github.com> Date: Tue, 1 Mar 2022 17:46:50 -0600 Subject: [PATCH] wind should work rn --- .../DebugMoveState/dMoveStateManager.cs | 11 +++++++++++ .../MovementState/MoveStateManager.cs | 6 +++++- Assets/Scripts/PlayerScripts/PlayerStats.cs | 10 +++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs index 67d7319..08dc01b 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs @@ -146,6 +146,10 @@ public class dMoveStateManager : NetworkBehaviour //if camera is enabled then rotate if(cam.enabled) Rotation(); else Debug.Log("Cam Disabled"); + + if(moveController.enabled){ + ApplyWind(pStats.WindOn); + } //calls any logic in the fixed update state from current state currentState.FixedUpdateState(this); @@ -301,6 +305,13 @@ public class dMoveStateManager : NetworkBehaviour moveZ = Vector3.zero; driftVel = Vector3.zero; } + + //Apply Wind movement to the player + public void ApplyWind(bool wind){ + if(wind){ + moveController.Move(pStats.WindDirection.normalized * 2); + } + } //// } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs index 63c7357..a0802b8 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs @@ -144,6 +144,10 @@ public class MoveStateManager : NetworkBehaviour //if camera is enabled then rotate if(cam.enabled) Rotation(); else Debug.Log("Cam Disabled"); + + if(moveController.enabled){ + ApplyWind(pStats.WindOn); + } //calls any logic in the fixed update state from current state currentState.FixedUpdateState(this); @@ -302,7 +306,7 @@ public class MoveStateManager : NetworkBehaviour //Apply Wind movement to the player public void ApplyWind(bool wind){ if(wind){ - + moveController.Move(pStats.WindDirection.normalized * 2); } } diff --git a/Assets/Scripts/PlayerScripts/PlayerStats.cs b/Assets/Scripts/PlayerScripts/PlayerStats.cs index 78f78cb..da5e7cc 100644 --- a/Assets/Scripts/PlayerScripts/PlayerStats.cs +++ b/Assets/Scripts/PlayerScripts/PlayerStats.cs @@ -151,11 +151,17 @@ public class PlayerStats : MonoBehaviour get{ return windOn; } } + [SerializeField] private Vector3 windDirection; + public Vector3 WindDirection{ + get{ return windDirection; } + set{ windDirection = value; } + } + private float tempTraction; private float tempAcc; private float accModification; - public void SetWeather(Weather weather){ + public void SetWeather(Weather weather, Vector3 windDir){ switch(weather){ case Weather.Rain:{ Debug.Log("Rain"); @@ -195,6 +201,8 @@ public class PlayerStats : MonoBehaviour case Weather.Wind:{ Debug.Log("Wind"); + + windDirection = windDir; windOn = true; break; }