From aba5c41ffd59c3ed0a3fb5cac171e55302b728af Mon Sep 17 00:00:00 2001 From: in0finite Date: Sat, 13 Jul 2019 15:54:49 +0200 Subject: [PATCH] extract method --- .../Behaviours/Ped/States/CrouchAimState.cs | 9 +-------- .../Scripts/Behaviours/Ped/States/CrouchState.cs | 15 +++++++++++++++ Docs/Multiplayer.md | 2 -- Docs/TODO.md | 12 +++++++++--- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Assets/Scripts/Behaviours/Ped/States/CrouchAimState.cs b/Assets/Scripts/Behaviours/Ped/States/CrouchAimState.cs index 43ab825c..0979349f 100644 --- a/Assets/Scripts/Behaviours/Ped/States/CrouchAimState.cs +++ b/Assets/Scripts/Behaviours/Ped/States/CrouchAimState.cs @@ -95,14 +95,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States // if( !this.IsActiveState ) // return; - // we need to adjust local position of some bones - root frame needs to be 0.5 units below the ped - - // for some reason, y position always remains 0.25 - // m_model.UnnamedFrame.transform.localPosition = m_model.UnnamedFrame.transform.localPosition.WithXAndZ(); - - Vector3 pos = m_model.RootFrame.transform.localPosition; - pos.y = -0.5f - m_model.UnnamedFrame.transform.localPosition.y; - m_model.RootFrame.transform.localPosition = pos; + CrouchState.AdjustRootFramePosition(m_ped); } diff --git a/Assets/Scripts/Behaviours/Ped/States/CrouchState.cs b/Assets/Scripts/Behaviours/Ped/States/CrouchState.cs index 606686db..7ed6ef31 100644 --- a/Assets/Scripts/Behaviours/Ped/States/CrouchState.cs +++ b/Assets/Scripts/Behaviours/Ped/States/CrouchState.cs @@ -35,6 +35,21 @@ namespace SanAndreasUnity.Behaviours.Peds.States } } + public static void AdjustRootFramePosition(Ped ped) + { + // we need to adjust local position of some bones - root frame needs to be 0.5 units below the ped + + var model = ped.PlayerModel; + + // for some reason, y position always remains 0.25 + // m_model.UnnamedFrame.transform.localPosition = m_model.UnnamedFrame.transform.localPosition.WithXAndZ(); + + Vector3 pos = model.RootFrame.transform.localPosition; + pos.y = -0.5f - model.UnnamedFrame.transform.localPosition.y; + model.RootFrame.transform.localPosition = pos; + + } + public override void OnJumpPressed () { // switch to stand state diff --git a/Docs/Multiplayer.md b/Docs/Multiplayer.md index 6db63183..b51e6a5a 100644 --- a/Docs/Multiplayer.md +++ b/Docs/Multiplayer.md @@ -16,8 +16,6 @@ - sometimes, current vehicle is null on client -- play horn sound ? - *** - is weapon sound 3d ? diff --git a/Docs/TODO.md b/Docs/TODO.md index 0a110fd7..c3964327 100644 --- a/Docs/TODO.md +++ b/Docs/TODO.md @@ -20,15 +20,21 @@ - Does 'O' button changes quality level ? -- Check how much RAM textures use +- **Check how much RAM textures use ; don't load them on headless server ;** -- Map window: draw vehicles ; +- **When model is changed for a passenger, his position is moved to start of anim** ; + +- **Are weapon audio clips unloaded ?** + +- Map window: **draw vehicles** ; + +- Play sounds: horn ; empty weapon slot ; ped damage ; footsteps in run and sprint states ; - Script execution order: HUD before pause menu and windows ; fps counter after all ; - Add option to change fixed delta time ? -- Crouching: adjust camera aim offset ? ; adjust height offset of ped ; +- Crouching: adjust camera aim offset ? ; **adjust height offset of ped - only state that needs to do this is CrouchState** ; - Optimize Console.Update() - don't do trim excess for every log message