Split the PlayerMovement class into mulltiple files

This commit is contained in:
2025-03-28 12:31:42 +00:00
parent 46eec303e0
commit b69a6028f6
11 changed files with 326 additions and 251 deletions

View File

@@ -0,0 +1,21 @@
using UnityEngine;
public partial class PlayerMovement : MonoBehaviour
{
private void UpdateWallRunState()
{
// Calculates the foward direction of the wall
Vector3 normal = m_HitRhsWall ? m_RhsWall.normal : m_LhsWall.normal;
Vector3 foward = Vector3.Cross(normal, transform.up);
// Flips the foward direction if facing the other direction
if ((m_Orientation.forward - foward).magnitude > (m_Orientation.forward - (-foward)).magnitude)
{ foward = -foward; }
// Applies the wall running force to the player
m_Body.AddForce(foward * m_WallRunSpeed * m_Body.mass * 10.0f, ForceMode.Force);
// Removes any vertical velocity the player may have
m_Body.velocity = new Vector3(m_Body.velocity.x, 0.0f, m_Body.velocity.z);
}
}