diff --git a/Assets/Resources/Prefabs/Floor1.prefab b/Assets/Resources/Prefabs/Floor1.prefab index 9a87dc8..953961f 100644 --- a/Assets/Resources/Prefabs/Floor1.prefab +++ b/Assets/Resources/Prefabs/Floor1.prefab @@ -70,8 +70,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 280184748253195406} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -20, y: 2.5, z: 30} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: -20, y: 25, z: 30} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 1 @@ -162,8 +162,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1476810453424496305} m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} - m_LocalPosition: {x: 30, y: 2.5, z: 0} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: 30, y: 25, z: 0} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 11 @@ -254,8 +254,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1498252682095002001} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 20, y: 2.5, z: 30} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: 20, y: 25, z: 30} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 4 @@ -346,8 +346,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3086981418125080490} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 2.5, z: -30} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: 0, y: 25, z: -30} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 13 @@ -438,8 +438,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4574217072564540737} m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} - m_LocalPosition: {x: -30, y: 2.5, z: -20} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: -30, y: 25, z: -20} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 8 @@ -530,8 +530,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5297680539094653773} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 20, y: 2.5, z: -30} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: 20, y: 25, z: -30} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 5 @@ -622,8 +622,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5306271776813103305} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 2.5, z: 30} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: 0, y: 25, z: 30} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 12 @@ -714,8 +714,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5394417702960208629} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -20, y: 2.5, z: -30} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: -20, y: 25, z: -30} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 3 @@ -807,7 +807,7 @@ Transform: m_GameObject: {fileID: 5527471193783807521} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 6, y: 1, z: 6} + m_LocalScale: {x: 5.9, y: 1, z: 5.9} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 0 @@ -899,8 +899,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5832176054667282246} m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} - m_LocalPosition: {x: -30, y: 2.5, z: 20} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: -30, y: 25, z: 20} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 7 @@ -991,8 +991,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6496789632411407146} m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} - m_LocalPosition: {x: 30, y: 2.5, z: 20} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: 30, y: 25, z: 20} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 6 @@ -1083,8 +1083,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7423742355937817825} m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} - m_LocalPosition: {x: -30, y: 2.5, z: 0} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: -30, y: 25, z: 0} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 10 @@ -1175,8 +1175,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7534871354282298220} m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} - m_LocalPosition: {x: 30, y: 2.5, z: -20} - m_LocalScale: {x: 20, y: 5, z: 1} + m_LocalPosition: {x: 30, y: 25, z: -20} + m_LocalScale: {x: 20, y: 50, z: 1} m_Children: [] m_Father: {fileID: 6078289230362060738} m_RootOrder: 9 diff --git a/Assets/Scripts/NetworkInstantiator.cs b/Assets/Scripts/NetworkInstantiator.cs index 0745d92..b7f91de 100644 --- a/Assets/Scripts/NetworkInstantiator.cs +++ b/Assets/Scripts/NetworkInstantiator.cs @@ -44,8 +44,6 @@ internal GameObject InstantiatePlayer(Player player, bool masterObject = false) PlayerController pc = go.GetComponent(); pc.playerRigidbody = go.GetComponent(); pc.weapon = go.GetComponentInChildren(); - pc.hitSpeed = 1.5f; - pc.speed = 10f; NetworkMaster master = go.AddComponent(); master.UpdateEvent = NetworkUpdate; diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index dade246..9e124d6 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -6,8 +6,8 @@ public class PlayerController : MonoBehaviour { // Start is called before the first frame update public Rigidbody playerRigidbody; - public float speed; - public float hitSpeed; + public float speed = 15f; + public float hitSpeed = 3f; public Weapon weapon; private Animator animator; private bool isAttacking; @@ -21,10 +21,14 @@ void Start() } // Update is called once per frame - void Update() + void FixedUpdate() { ApplyMovement(); - ApplyRotation(); + if (!isAttacking) + { + ApplyRotation(); + } + HandleWeaponAttack(); } @@ -32,15 +36,12 @@ private void ApplyMovement() { float mH = Input.GetAxis("Horizontal"); float mV = Input.GetAxis("Vertical"); - if (playerRigidbody.velocity.y < -10 || isAttacking) + if (playerRigidbody.velocity.y >= -10) { - playerRigidbody.velocity = new Vector3(0, playerRigidbody.velocity.y, 0); + Vector3 movement = isAttacking ? Vector3.zero : speed * new Vector3(mH, 0, mV).normalized; + playerRigidbody.velocity = movement + (Vector3.up * playerRigidbody.velocity.y); } - else - { - playerRigidbody.velocity = new Vector3(mH * speed, playerRigidbody.velocity.y, mV * speed); - } - + if (System.Math.Abs(mH) > 0 || System.Math.Abs(mV) > 0) { animator.SetBool("isWalking", true); @@ -78,7 +79,7 @@ private void HandleWeaponAttack() weapon.Attack(); animator.SetBool("isAttacking", true); isAttacking = true; - StartCoroutine(WaitAttack()); + StartCoroutine(WaitAttack()); } } diff --git a/ProjectSettings/DynamicsManager.asset b/ProjectSettings/DynamicsManager.asset index c8d2efc..2df761a 100644 --- a/ProjectSettings/DynamicsManager.asset +++ b/ProjectSettings/DynamicsManager.asset @@ -4,9 +4,9 @@ PhysicsManager: m_ObjectHideFlags: 0 serializedVersion: 13 - m_Gravity: {x: 0, y: -50, z: 0} + m_Gravity: {x: 0, y: -100, z: 0} m_DefaultMaterial: {fileID: 0} - m_BounceThreshold: 2 + m_BounceThreshold: 0 m_SleepThreshold: 0.005 m_DefaultContactOffset: 0.01 m_DefaultSolverIterations: 6 diff --git a/ProjectSettings/TimeManager.asset b/ProjectSettings/TimeManager.asset index 558a017..f50f9b7 100644 --- a/ProjectSettings/TimeManager.asset +++ b/ProjectSettings/TimeManager.asset @@ -3,7 +3,7 @@ --- !u!5 &1 TimeManager: m_ObjectHideFlags: 0 - Fixed Timestep: 0.02 + Fixed Timestep: 0.017 Maximum Allowed Timestep: 0.33333334 m_TimeScale: 1 Maximum Particle Timestep: 0.03