diff --git a/Assets/Prefabs/Game/PlayerHUD.prefab b/Assets/Prefabs/Game/PlayerHUD.prefab index 4e6e0e9..ac71d55 100644 --- a/Assets/Prefabs/Game/PlayerHUD.prefab +++ b/Assets/Prefabs/Game/PlayerHUD.prefab @@ -34,7 +34,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 740, y: 490} + m_AnchoredPosition: {x: -719, y: -484} m_SizeDelta: {x: 400, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3600411886259146374 diff --git a/Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab b/Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab index f84e96d..77a063a 100644 --- a/Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab +++ b/Assets/Prefabs/Player/DebugSMPlayerPrefab.prefab @@ -928,6 +928,7 @@ GameObject: - component: {fileID: 1707207228499037412} - component: {fileID: 1707207228499037411} - component: {fileID: 1707207228499037410} + - component: {fileID: 2620177443006759317} m_Layer: 3 m_Name: T-Pose m_TagString: ArcherTarget @@ -1169,6 +1170,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: moveController: {fileID: 0} + animator: {fileID: 0} pStats: {fileID: 0} mSM: {fileID: 0} driver: {fileID: 0} @@ -1189,6 +1191,7 @@ MonoBehaviour: moveController: {fileID: 0} rB: {fileID: 0} capCol: {fileID: 0} + animator: {fileID: 0} pStats: {fileID: 0} aSM: {fileID: 0} idleLimit: 0.3 @@ -1217,6 +1220,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: moveController: {fileID: 0} + animator: {fileID: 0} pStats: {fileID: 0} mSM: {fileID: 0} driver: {fileID: 0} @@ -1238,9 +1242,22 @@ MonoBehaviour: leg: {fileID: 0} legHitbox: {fileID: 0} moveController: {fileID: 0} + animator: {fileID: 0} pStats: {fileID: 0} mSM: {fileID: 0} aSM: {fileID: 0} +--- !u!114 &2620177443006759317 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1707207228499037409} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: db0579f1149ac2f4295639b1c9430bf6, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1832820220301833206 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab b/Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab index 72487f5..6846d12 100644 --- a/Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab +++ b/Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab @@ -4598,7 +4598,7 @@ GameObject: - component: {fileID: 7688428083034862390} - component: {fileID: 7688428083034862391} - component: {fileID: 7391821093297401085} - - component: {fileID: 7866023119774536007} + - component: {fileID: 3857312965804109841} m_Layer: 0 m_Name: T-Pose m_TagString: ArcherTarget @@ -4708,7 +4708,7 @@ Rigidbody: m_IsKinematic: 1 m_Interpolate: 0 m_Constraints: 0 - m_CollisionDetection: 0 + m_CollisionDetection: 3 --- !u!136 &7688428083034862282 CapsuleCollider: m_ObjectHideFlags: 0 @@ -4802,6 +4802,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: moveController: {fileID: 0} + animator: {fileID: 0} pStats: {fileID: 0} mSM: {fileID: 0} curJumpNum: 0 @@ -4844,6 +4845,7 @@ MonoBehaviour: moveController: {fileID: 0} rB: {fileID: 0} capCol: {fileID: 0} + animator: {fileID: 0} pStats: {fileID: 0} aSM: {fileID: 0} idleLimit: 0.3 @@ -4859,7 +4861,6 @@ MonoBehaviour: sensitivity: 200 dirHit: {x: 0, y: 0, z: 0} distToGround: 0 - prevRot: {x: 0, y: 0, z: 0} --- !u!114 &7688428083034862389 MonoBehaviour: m_ObjectHideFlags: 0 @@ -4873,6 +4874,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: moveController: {fileID: 0} + animator: {fileID: 0} pStats: {fileID: 0} mSM: {fileID: 0} driver: {fileID: 0} @@ -4889,6 +4891,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5f89839a9c7d0204ea00e910d9c5c5ee, type: 3} m_Name: m_EditorClassIdentifier: + parentObj: {fileID: 0} moveController: {fileID: 0} pStats: {fileID: 0} mSM: {fileID: 0} @@ -4911,6 +4914,7 @@ MonoBehaviour: leg: {fileID: 0} legHitbox: {fileID: 0} moveController: {fileID: 0} + animator: {fileID: 0} pStats: {fileID: 0} mSM: {fileID: 0} aSM: {fileID: 0} @@ -4926,7 +4930,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4f942eeaa888c98468c9ad196fb88115, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &7866023119774536007 +--- !u!114 &3857312965804109841 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -4935,7 +4939,7 @@ MonoBehaviour: m_GameObject: {fileID: 7688428083034862386} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: db0579f1149ac2f4295639b1c9430bf6, type: 3} + m_Script: {fileID: 11500000, guid: 8ab36263847f7f2408ee4621b46003a3, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1 &7740096766088430285 diff --git a/Assets/Scenes/Demos/MovementScene.unity b/Assets/Scenes/Demos/MovementScene.unity index 44b8de4..90b68f9 100644 --- a/Assets/Scenes/Demos/MovementScene.unity +++ b/Assets/Scenes/Demos/MovementScene.unity @@ -3002,7 +3002,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 11 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2061208975 GameObject: @@ -3099,16 +3099,28 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2061208975} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1001 &4713506341404860824 +--- !u!1001 &4756939987922741697 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1707207228499037468, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} + propertyPath: jumpPow + value: 60 + objectReference: {fileID: 0} + - target: {fileID: 1707207228499037468, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} + propertyPath: hasGlider + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1707207228499037468, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} + propertyPath: hasGrapple + value: 0 + objectReference: {fileID: 0} - target: {fileID: 5759777694531189237, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} propertyPath: m_RootOrder - value: 10 + value: 11 objectReference: {fileID: 0} - target: {fileID: 5759777694531189237, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} propertyPath: m_LocalPosition.x @@ -3116,7 +3128,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5759777694531189237, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} propertyPath: m_LocalPosition.y - value: 4.72 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5759777694531189237, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} propertyPath: m_LocalPosition.z diff --git a/Assets/Scripts/KingScripts/Boulder.cs b/Assets/Scripts/KingScripts/Boulder.cs index c6ee521..a4df0f5 100644 --- a/Assets/Scripts/KingScripts/Boulder.cs +++ b/Assets/Scripts/KingScripts/Boulder.cs @@ -7,20 +7,26 @@ using UnityEngine; public class Boulder : NetworkBehaviour { private Rigidbody boulder; + public float bumpPower = 70; void Start() { boulder = GetComponent();//Gets the rigidbody attached to the bolder } - void OnTriggerEnter(Collider other) { - if (other.gameObject.tag == "ArcherTarget") { - GameObject player = other.gameObject;//Turns the collider into a game object - Vector3 Dir = boulder.velocity;//Finds the bolder's velocity - float Power = boulder.velocity.magnitude;// * 250;//Finds the power of the boulder by using it's velocity and a scaler - Dir = Vector3.Normalize(Dir);//Normalizes the vector to be used as a knockback direction - //Knock the player a little to the side - Dir.z += Random.Range(-0.25f, 0.25f); - player.GetComponent().GetHit(Dir, Power); //Ragdolls the player in the direction of the bolder depending on it's speed + void OnTriggerEnter(Collider objectHit) { + if (objectHit.gameObject.tag == "ArcherTarget") { + + Debug.Log("Bump"); + MoveStateManager playerMovement = objectHit.GetComponent(); + + float DirBumpX = playerMovement.driftVel.x * -1;//Inverts the Player Velocity x + float DirBumpY = .1f; + float DirBumpZ = playerMovement.driftVel.z * -1;//Inverts the Player Velocity z + + Vector3 DirBump = new Vector3(DirBumpX, DirBumpY, DirBumpZ);//Creates a direction to launch the player + DirBump = Vector3.Normalize(DirBump);//Normalizes the vector to be used as a bump direction + + playerMovement.GetHit(DirBump, bumpPower); } } diff --git a/Assets/Scripts/KingScripts/KingAbilities/Rain.cs b/Assets/Scripts/KingScripts/KingAbilities/Rain.cs deleted file mode 100644 index 41e87ab..0000000 --- a/Assets/Scripts/KingScripts/KingAbilities/Rain.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Rain : MonoBehaviour -{ - private float tractionDefault; - private float accelerationDefault; - //Options for reduction - // % based aka you have 75% traction while in rain <- with this option we wouldn't need to care about individual players starting points - // Flat reduction penalty of number i.e. 3? - - //Make rain increase acceleration - - - private void OnTriggerEnter(Collider other) - { - if (other.tag == "Player") //In multiplayer we may need a player 1 - X tag for keeping track of individual stats - { - PlayerStats pStats = other.gameObject.GetComponent(); - tractionDefault = pStats.Traction; - if (tractionDefault > 3) - { - pStats.Traction -= 3; - } - else - { - pStats.Traction = 1; - } - - accelerationDefault = pStats.Acc; - if (accelerationDefault < 8) - { - pStats.Acc += 3; - } - else - { - pStats.Acc = 10; - } - - //pStats.Acc *= 1.25f; - //pStats.Traction *= 0.75f; - } - } - - private void OnTriggerExit(Collider other) - { - if (other.tag == "Player") - { - PlayerStats pStats = other.gameObject.GetComponent(); - pStats.Traction = tractionDefault; - pStats.Acc = accelerationDefault; - //pStats.Acc /= 1.25f; - //pStats.Traction /= 0.75f; - } - } -} diff --git a/Assets/Scripts/KingScripts/KingAbilities/Rain.cs.meta b/Assets/Scripts/KingScripts/KingAbilities/Rain.cs.meta deleted file mode 100644 index 7c97f91..0000000 --- a/Assets/Scripts/KingScripts/KingAbilities/Rain.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c28022a6946b2ed44b657d7aecae5c1c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/KingScripts/KingAbilities/Snow.cs b/Assets/Scripts/KingScripts/KingAbilities/Snow.cs deleted file mode 100644 index 9aea7b3..0000000 --- a/Assets/Scripts/KingScripts/KingAbilities/Snow.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Snow : MonoBehaviour -{ - private float tractionDefault; - private float accelerationDefault; - //Options for increase - // % based aka you have 75% traction while in rain <- with this option we wouldn't need to care about individual players starting points - // Flat reduction penalty of number i.e. 3? - - //snow reduces acceleration <- playtest to consider adjusting max speed as well - - private void OnTriggerEnter(Collider other) - { - if (other.tag == "Player") //In multiplayer we may need a player 1 - X tag for keeping track of individual stats - { - PlayerStats pStats = other.gameObject.GetComponent(); - tractionDefault = pStats.Traction; - if (tractionDefault < 8) - { - pStats.Traction += 3; - } - else - { - pStats.Traction = 10; - } - - accelerationDefault = pStats.Acc; - if (accelerationDefault > 3) - { - pStats.Acc -= 3; - } - else - { - pStats.Acc = 1; - } - - //pStats.Traction *= 1.25f; - //pStats.Acc *= 0.75f; - } - } - - private void OnTriggerExit(Collider other) - { - if (other.tag == "Player") - { - PlayerStats pStats = other.gameObject.GetComponent(); - pStats.Traction = tractionDefault; - pStats.Acc = accelerationDefault; - //pStats.Traction /= 1.25f; - //pStats.Acc /= 0.75f; - } - } -} diff --git a/Assets/Scripts/KingScripts/KingAbilities/Snow.cs.meta b/Assets/Scripts/KingScripts/KingAbilities/Snow.cs.meta deleted file mode 100644 index 1d3fb8e..0000000 --- a/Assets/Scripts/KingScripts/KingAbilities/Snow.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: c3ae4500a963332498d7e31700c2a9ae -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/KingScripts/Wind.cs b/Assets/Scripts/KingScripts/Wind.cs deleted file mode 100644 index 784eb03..0000000 --- a/Assets/Scripts/KingScripts/Wind.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Wind : MonoBehaviour -{ - public Vector3 DirWind; - // Start is called before the first frame update - void Start() - { - DirWind = Vector3.forward; - } - - // Update is called once per frame - void OnTriggerStay(Collider other) - { - other.GetComponent().AddImpact(DirWind, 1); - } -} diff --git a/Assets/Scripts/KingScripts/Wind.cs.meta b/Assets/Scripts/KingScripts/Wind.cs.meta deleted file mode 100644 index b99d72a..0000000 --- a/Assets/Scripts/KingScripts/Wind.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 3cbfce7770492384d8edacf924191f0a -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs index a5d659a..6e2ce33 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialFallingState.cs @@ -10,7 +10,7 @@ public class dAerialFallingState : dAerialBaseState public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){ - } + } public override void UpdateState(dAerialStateManager aSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGlidingState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGlidingState.cs index e121db4..e7dd0ae 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGlidingState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGlidingState.cs @@ -9,12 +9,15 @@ public class dAerialGlidingState : dAerialBaseState //Modify base traction aSM.pStats.CurTraction = 1.0f; + + } public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){ //return traction to normal aSM.pStats.CurTraction = aSM.pStats.Traction; + } public override void UpdateState(dAerialStateManager aSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGroundedState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGroundedState.cs index 5a332c7..9fb1d48 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGroundedState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugAerial/dAerialGroundedState.cs @@ -8,6 +8,8 @@ public class dAerialGroundedState : dAerialBaseState //release is false if grounded aSM.release = false; + + } public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleAirState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleAirState.cs index d17ef67..0941342 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleAirState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/DebugGrapple/dAerialGrappleAirState.cs @@ -22,6 +22,10 @@ public class dAerialGrappleAirState : dAerialBaseState float oldSwingMom; // old swing Momentum amplifier Vector3 momDirection; // momentum direction Vector3 tensionMomDirection; // tension momentum direction + + float defaultGraceTimer = 1.0f; // default timer + float graceTimer; // grace period at the end of the swing so the player has time to let go + bool swingGrace = true; // is the grace timer over public override void EnterState(dAerialStateManager aSM, dAerialBaseState previousState){ @@ -47,6 +51,7 @@ public class dAerialGrappleAirState : dAerialBaseState aSM.release = false; // player hasn't released aSM.lerpRelease = Vector3.zero; // reset lerp release spaceHeld = true; + graceTimer = defaultGraceTimer; //sets grace timer } public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){ @@ -116,6 +121,7 @@ public class dAerialGrappleAirState : dAerialBaseState //if Swing Momentum isn't zero then move player if(swingMom != 0){ aSM.moveController.Move(CalculateMomentumDirection(aSM.pStats.GravVel, aSM.hookPoint.transform.position, aSM)); + swingMom -= .5f; } if(swingMom<0) swingMom = 0; @@ -156,8 +162,17 @@ public class dAerialGrappleAirState : dAerialBaseState //if player is on the other side of hookpoint and swingMom is lower then update oldXZDir if(oldXZDir != curXZDir && swingMom <= (oldSwingMom*(.75f))){ - oldSwingMom = swingMom; - oldXZDir = (new Vector3(aSM.hookPoint.transform.position.x,0,aSM.hookPoint.transform.position.z) - new Vector3(aSM.transform.position.x,0,aSM.transform.position.z)).normalized; + if(graceTimer >= 0){ + swingGrace = false; + graceTimer -= .1f; + } + else{ + oldSwingMom = swingMom; + oldXZDir = (new Vector3(aSM.hookPoint.transform.position.x,0,aSM.hookPoint.transform.position.z) - new Vector3(aSM.transform.position.x,0,aSM.transform.position.z)).normalized; + swingGrace = true; + graceTimer = defaultGraceTimer; + } + } //current line between hookpoint and player @@ -179,7 +194,7 @@ public class dAerialGrappleAirState : dAerialBaseState } //calculates swing momentum based on height ands speed - float sMom = playerSpeed + (swingHeight * 2.5f); + float sMom = playerSpeed + (swingHeight * 3f); if(sMom > aSM.maxSwingMom){ sMom = aSM.maxSwingMom; } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs index a04ef20..ada6903 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugAerialState/dAerialStateManager.cs @@ -270,7 +270,7 @@ public class dAerialStateManager : NetworkBehaviour void Jump(){ if(!pStats.IsPaused){ //If space/south gamepad button is pressed apply an upwards force to the player - if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && (mSM.currentState != mSM.SlideState && mSM.currentState != mSM.CrouchState && mSM.currentState != mSM.RagdollState && mSM.currentState != mSM.RecoveringState)) + if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && (mSM.currentState != mSM.SlideState && mSM.currentState != mSM.CrouchState && mSM.currentState != mSM.RagdollState && mSM.currentState != mSM.RecoveringState && currentState != GlidingState)) { if(currentState == WallRunState){ AddImpact((GetWallJumpDirection()), pStats.JumpPow * 8.5f); diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugIncapacitated/dMoveRagdollState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugIncapacitated/dMoveRagdollState.cs index 7b73571..b8c9efe 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugIncapacitated/dMoveRagdollState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugIncapacitated/dMoveRagdollState.cs @@ -12,18 +12,20 @@ public class dMoveRagdollState : dMoveBaseState public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){ ragTime = mSM.pStats.RecovTime; // how long to be ragdolled - mSM.prevRot = mSM.transform.localEulerAngles; // save previous rotation + prevRot = mSM.transform.localEulerAngles; // save previous rotation mSM.capCol.enabled = true; // enable capsule collider mSM.moveController.enabled = false; // disable move controller mSM.rB.isKinematic = false; // disable kinematic mSM.rB.detectCollisions = true; // detect collisions + mSM.rB.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; //apply force mSM.rB.AddForce(mSM.dirHit, ForceMode.Impulse); } public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){ - + mSM.transform.localEulerAngles = prevRot; // reset player rotation + mSM.rB.collisionDetectionMode = CollisionDetectionMode.Discrete; } public override void UpdateState(dMoveStateManager mSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugIncapacitated/dMoveRecoveringState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugIncapacitated/dMoveRecoveringState.cs index ec5671d..585b415 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugIncapacitated/dMoveRecoveringState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugIncapacitated/dMoveRecoveringState.cs @@ -12,7 +12,6 @@ public class dMoveRecoveringState : dMoveBaseState mSM.moveController.enabled = true; // enable move controller mSM.rB.isKinematic = true; // enable kinematic mSM.rB.detectCollisions = false; // detect collisions false - mSM.transform.localEulerAngles = mSM.prevRot; // reset player rotation mSM.CancelMomentum(); // reset player variables mSM.moveController.Move(new Vector3(0,2,0)); } diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs index 793d0db..4fd404f 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveIdleState.cs @@ -6,12 +6,12 @@ public class dMoveIdleState : dMoveBaseState { public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){ mSM.GetComponent().SetBool("isIdle", true); - Debug.Log("Entered Idle"); + //Debug.Log("Entered Idle"); } public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){ mSM.GetComponent().SetBool("isIdle", false); - Debug.Log("Exited Idle"); + //Debug.Log("Exited Idle"); } public override void UpdateState(dMoveStateManager mSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs index 633624e..445a4bd 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveJogState.cs @@ -6,12 +6,12 @@ public class dMoveJogState : dMoveBaseState { public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){ mSM.GetComponent().SetBool("isJogging", true); - Debug.Log("Entered Jog"); + //Debug.Log("Entered Jog"); } public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){ mSM.GetComponent().SetBool("isJogging", false); - Debug.Log("Exited Jog"); + //Debug.Log("Exited Jog"); } public override void UpdateState(dMoveStateManager mSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs index 6393a18..6de77de 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveRunState.cs @@ -6,12 +6,12 @@ public class dMoveRunState : dMoveBaseState { public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){ mSM.GetComponent().SetBool("isRunning", true); - Debug.Log("Entered Run"); + //Debug.Log("Entered Run"); } public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){ mSM.GetComponent().SetBool("isRunning", false); - Debug.Log("Exit Run"); + //Debug.Log("Exit Run"); } public override void UpdateState(dMoveStateManager mSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs index ab737fd..84deeef 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/DebugWASD/dMoveWalkState.cs @@ -9,12 +9,12 @@ public class dMoveWalkState : dMoveBaseState public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){ //get component is semi expensive--may want to ahve all statemanagers have a reference to animator mSM.GetComponent().SetBool("isWalking", true); - Debug.Log("Entered Walk"); + //Debug.Log("Entered Walk"); } public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){ mSM.GetComponent().SetBool("isWalking", false); - Debug.Log("Exited Walk"); + //Debug.Log("Exited Walk"); } public override void UpdateState(dMoveStateManager mSM){ diff --git a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs index 2f462d4..0baf82f 100644 --- a/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/DebugStateMachine/DebugMoveState/dMoveStateManager.cs @@ -78,7 +78,6 @@ public class dMoveStateManager : NetworkBehaviour //Ragdoll Variables public Vector3 dirHit; // Direction hit public float distToGround; // distance to ground - public Vector3 prevRot; // previous rotation before ragdolled //// diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs index 8280f45..60845b2 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/AerialStateManager.cs @@ -276,7 +276,7 @@ public class AerialStateManager : NetworkBehaviour void Jump(){ if(!pStats.IsPaused){ //If space/south gamepad button is pressed apply an upwards force to the player - if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && (mSM.currentState != mSM.SlideState && mSM.currentState != mSM.CrouchState && mSM.currentState != mSM.RagdollState && mSM.currentState != mSM.RecoveringState)) + if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && (mSM.currentState != mSM.SlideState && mSM.currentState != mSM.CrouchState && mSM.currentState != mSM.RagdollState && mSM.currentState != mSM.RecoveringState && currentState != GlidingState)) { if(currentState == WallRunState){ AddImpact((GetWallJumpDirection()), pStats.JumpPow * 8.5f); diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleAirState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleAirState.cs index 0ab3aa7..993aa07 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleAirState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/AerialState/Grapple/AerialGrappleAirState.cs @@ -23,6 +23,10 @@ public class AerialGrappleAirState : AerialBaseState Vector3 momDirection; // momentum direction Vector3 tensionMomDirection; // tension momentum direction + float defaultGraceTimer = 1.0f; // default timer + float graceTimer; // grace period at the end of the swing so the player has time to let go + bool swingGrace = true; // is the grace timer over + public override void EnterState(AerialStateManager aSM, AerialBaseState previousState){ //refresh jump number @@ -47,6 +51,7 @@ public class AerialGrappleAirState : AerialBaseState aSM.release = false; // player hasn't released aSM.lerpRelease = Vector3.zero; // reset lerp release spaceHeld = true; + graceTimer = defaultGraceTimer; //sets grace timer } public override void ExitState(AerialStateManager aSM, AerialBaseState nextState){ @@ -156,8 +161,17 @@ public class AerialGrappleAirState : AerialBaseState //if player is on the other side of hookpoint and swingMom is lower then update oldXZDir if(oldXZDir != curXZDir && swingMom <= (oldSwingMom*(.75f))){ - oldSwingMom = swingMom; - oldXZDir = (new Vector3(aSM.hookPoint.transform.position.x,0,aSM.hookPoint.transform.position.z) - new Vector3(aSM.transform.position.x,0,aSM.transform.position.z)).normalized; + if(graceTimer >= 0){ + swingGrace = false; + graceTimer -= .1f; + } + else{ + oldSwingMom = swingMom; + oldXZDir = (new Vector3(aSM.hookPoint.transform.position.x,0,aSM.hookPoint.transform.position.z) - new Vector3(aSM.transform.position.x,0,aSM.transform.position.z)).normalized; + swingGrace = true; + graceTimer = defaultGraceTimer; + } + } //current line between hookpoint and player diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Incapacitated/MoveRagdollState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Incapacitated/MoveRagdollState.cs index 6a8a7d1..b36e1b8 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Incapacitated/MoveRagdollState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Incapacitated/MoveRagdollState.cs @@ -7,11 +7,12 @@ public class MoveRagdollState : MoveBaseState float ragTime; // ragdoll timer bool beginRagTimer = false; // whether ragtimer has started + Vector3 prevRot; public override void EnterState(MoveStateManager mSM, MoveBaseState previousState){ ragTime = mSM.pStats.RecovTime; // how long to be ragdolled - mSM.prevRot = mSM.transform.localEulerAngles; // save previous rotation + prevRot = mSM.transform.localEulerAngles; // save previous rotation mSM.capCol.enabled = true; // enable capsule collider mSM.moveController.enabled = false; // disable move controller mSM.rB.isKinematic = false; // disable kinematic @@ -22,6 +23,7 @@ public class MoveRagdollState : MoveBaseState } public override void ExitState(MoveStateManager mSM, MoveBaseState nextState){ + mSM.transform.localEulerAngles = prevRot; // reset player rotation } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Incapacitated/MoveRecoveringState.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Incapacitated/MoveRecoveringState.cs index 12fa47b..1450a80 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Incapacitated/MoveRecoveringState.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/Incapacitated/MoveRecoveringState.cs @@ -12,7 +12,6 @@ public class MoveRecoveringState : MoveBaseState mSM.moveController.enabled = true; // enable move controller mSM.rB.isKinematic = true; // enable kinematic mSM.rB.detectCollisions = false; // detect collisions false - mSM.transform.localEulerAngles = mSM.prevRot; // reset player rotation mSM.CancelMomentum(); // reset player variables mSM.moveController.Move(new Vector3(0,2,0)); } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs index 0e1619f..90c370b 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/MovementState/MoveStateManager.cs @@ -78,7 +78,6 @@ public class MoveStateManager : NetworkBehaviour //Ragdoll Variables public Vector3 dirHit; // Direction hit public float distToGround; // distance to ground - public Vector3 prevRot; // previous rotation before ragdolled //// @@ -313,7 +312,7 @@ public class MoveStateManager : NetworkBehaviour //Apply Wind movement to the player public void ApplyWind(bool wind){ if(wind){ - moveController.Move(pStats.WindDirection.normalized * 2); + moveController.Move(pStats.WindDirection.normalized * .2f); } } diff --git a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/OffenseState/OffenseStateManager.cs b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/OffenseState/OffenseStateManager.cs index 0d2e006..4c488f8 100644 --- a/Assets/Scripts/PlayerScripts/NetworkedStateMachines/OffenseState/OffenseStateManager.cs +++ b/Assets/Scripts/PlayerScripts/NetworkedStateMachines/OffenseState/OffenseStateManager.cs @@ -39,10 +39,15 @@ public class OffenseStateManager : NetworkBehaviour public PlayerStats pStats; // Player Stats public MoveStateManager mSM; // move state manager public AerialStateManager aSM; // aerial state manager + //// + //// AnimatorManagerScript private AnimationManager animationManager; //// + //// Variables Section + private GameObject[] players; + void Awake(){ ////Initialize Player Components @@ -58,7 +63,6 @@ public class OffenseStateManager : NetworkBehaviour leg = transform.Find("Leg").gameObject; // Set Leg Object legHitbox = leg.transform.Find("LegHitbox").gameObject; // Set Leg Hitbox leg.SetActive(false); - parentObj = transform.parent.gameObject; // set parent object //// ////Initialize Scripts @@ -73,6 +77,7 @@ public class OffenseStateManager : NetworkBehaviour currentState = NoneState; previousState = NoneState; currentState.EnterState(this, previousState); + } void Update(){ @@ -121,10 +126,12 @@ public class OffenseStateManager : NetworkBehaviour if(collision.transform.CompareTag("ArcherTarget") && myCollider == legHitbox.GetComponent()){ Vector3 direction = this.transform.forward; - Debug.Log("---Player Being Kicked: " + collision.transform.root.GetComponent().NetworkObjectId); - Debug.Log("---Player Kicking: " + this.transform.root.GetComponent().NetworkObjectId); ulong netObjID = collision.gameObject.transform.root.GetComponent().NetworkObjectId; - ApplyKickServerRPC(direction, netObjID); + if(netObjID != this.transform.root.GetComponent().NetworkObjectId){ + Debug.Log("NetObjID of Kicked Player: " + netObjID); + ApplyKickServerRPC(direction, netObjID); + } + } if (collision.transform.CompareTag("destroyable") && myCollider == legHitbox.GetComponent()){ @@ -155,9 +162,27 @@ public class OffenseStateManager : NetworkBehaviour foreach(GameObject kickedPlayer in players){ //First check if the player is kicked - if(kickedPlayer.transform.root.GetComponent() != null && kickedPlayer.transform.root.GetComponent().NetworkObjectId == netObjId && kickedPlayer.transform.root.GetComponent().NetworkObjectId != this.transform.root.GetComponent().NetworkObjectId){ + + Debug.Log(kickedPlayer.transform.root.GetComponent().NetworkObjectId); + + if(kickedPlayer.transform.root.GetComponent().NetworkObjectId == netObjId){ + Debug.Log("Kicked Players NetObjId is equal to the NetObjId"); + } + else{ + Debug.Log("Kicked Player NetObjId not equal to the NetObjId"); + } + + if(kickedPlayer.transform.root.GetComponent().NetworkObjectId != this.transform.root.GetComponent().NetworkObjectId){ + Debug.Log("Kicked Player Not The Same as Me"); + } + else{ + Debug.Log("My RPC ID: " + this.transform.root.GetComponent().NetworkObjectId); + Debug.Log("Their RPC ID: " + kickedPlayer.transform.root.GetComponent().NetworkObjectId); + } + + if(kickedPlayer.transform.root.GetComponent() != null && kickedPlayer.transform.root.GetComponent().NetworkObjectId == netObjId){ Debug.Log("Kicking other user"); - kickedPlayer.GetComponent().GetHit(direction, 10); + kickedPlayer.GetComponent().GetHit(direction, 20); } return; diff --git a/Assets/Scripts/PlayerScripts/PlayerInventory.cs b/Assets/Scripts/PlayerScripts/PlayerInventory.cs index bc76be5..d472328 100644 --- a/Assets/Scripts/PlayerScripts/PlayerInventory.cs +++ b/Assets/Scripts/PlayerScripts/PlayerInventory.cs @@ -77,4 +77,10 @@ public class PlayerInventory : NetworkBehaviour AddItem(allItems[itemName]); } } + + public void ClearInventory(){ + foreach(KeyValuePair item in PlayerItemDict){ + RemoveItem(item.Value); + } + } } diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 35c4f3b..60996ce 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -12,28 +12,28 @@ EditorUserSettings: value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26 flags: 0 RecentlyUsedScenePath-2: - value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 - flags: 0 - RecentlyUsedScenePath-3: value: 22424703114646680e0b0227036c731f1415016439262f2434 flags: 0 + RecentlyUsedScenePath-3: + value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26 + flags: 0 RecentlyUsedScenePath-4: - value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 + value: 22424703114646680e0b0227036c7b151b180b650721283704240d14f0e12d3aedff78fce9332b25 flags: 0 RecentlyUsedScenePath-5: value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 flags: 0 RecentlyUsedScenePath-6: - value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26 + value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 flags: 0 RecentlyUsedScenePath-7: - value: 22424703114646680e0b0227036c7b151b180b650721283704240d14f0e12d3aedff78fce9332b25 + value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb flags: 0 RecentlyUsedScenePath-8: - value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb + value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 flags: 0 RecentlyUsedScenePath-9: - value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb + value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb flags: 0 vcSharedLogLevel: value: 0d5e400f0650