diff --git a/Assets/Prefabs/Game/Managers/SpawnManager.prefab b/Assets/Prefabs/Game/Managers/SpawnManager.prefab index 33afe4c..8b0d174 100644 --- a/Assets/Prefabs/Game/Managers/SpawnManager.prefab +++ b/Assets/Prefabs/Game/Managers/SpawnManager.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 2718425332668433510} - component: {fileID: 2718425332668433513} - component: {fileID: 2718425332668433511} + - component: {fileID: 8643895533179698638} m_Layer: 0 m_Name: SpawnManager m_TagString: Untagged @@ -63,3 +64,16 @@ MonoBehaviour: PrefabHashGenerator: SpawnManager AlwaysReplicateAsRoot: 0 DontDestroyWithOwner: 0 +--- !u!114 &8643895533179698638 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2718425332668433512} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 66519fc5420181e45850c591aa1179ec, type: 3} + m_Name: + m_EditorClassIdentifier: + allItems: [] diff --git a/Assets/Prefabs/Player/DebugPlayerPrefab.prefab b/Assets/Prefabs/Player/DebugPlayerPrefab.prefab index d1acf47..31c580f 100644 --- a/Assets/Prefabs/Player/DebugPlayerPrefab.prefab +++ b/Assets/Prefabs/Player/DebugPlayerPrefab.prefab @@ -205,13 +205,11 @@ GameObject: - component: {fileID: 3471270956356843213} - component: {fileID: 8100520363622627413} - component: {fileID: 7097691538269713306} - - component: {fileID: 7616279934999327372} - component: {fileID: 7058615058147771192} - component: {fileID: 3559681995605743320} - component: {fileID: 8445875817354890259} - component: {fileID: 4889953713382264203} - component: {fileID: 6743056025486776975} - - component: {fileID: 4367973138255890080} - component: {fileID: 4788888989419098570} - component: {fileID: 471283137481508403} - component: {fileID: 5784126162129930074} @@ -231,7 +229,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3607330906377400225} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -2, y: 1.25, z: 0} + m_LocalPosition: {x: -2.12, y: 1.25, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 2731864384567516644} @@ -311,20 +309,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5a5d879591af1084ab5d3a35fcd53086, type: 3} m_Name: m_EditorClassIdentifier: - items: [] + networkItemList: [] pStats: {fileID: 0} ---- !u!114 &7616279934999327372 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3607330906377400225} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1a8c22589436d2449a89cf3a40b6d252, type: 3} - m_Name: - m_EditorClassIdentifier: + invMan: {fileID: 0} --- !u!54 &7058615058147771192 Rigidbody: m_ObjectHideFlags: 0 @@ -441,20 +428,6 @@ MonoBehaviour: minAngle: -30 maxAngle: 45 sensitivity: 200 ---- !u!114 &4367973138255890080 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 3607330906377400225} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a504b3f7be0e5254e815029049abbeac, type: 3} - m_Name: - m_EditorClassIdentifier: - cam: {fileID: 0} - controller: {fileID: 0} --- !u!114 &4788888989419098570 MonoBehaviour: m_ObjectHideFlags: 0 @@ -508,15 +481,15 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f4264f4f7bed1d7499a037436582ed17, type: 3} m_Name: m_EditorClassIdentifier: - wallMaxDistance: 1 + wallMaxDistance: 5 wallSpeedMultiplier: 1.2 - minimumHeight: 1.2 + minimumHeight: 0.1 maxAngleRoll: 20 normalizedAngleThreshold: 0.1 - jumpDuration: 1 + jumpDuration: 0.02 wallBouncing: 3 cameraTransitionDuration: 1 - wallGravityDownForce: 20 + wallGravityDownForce: 3 --- !u!1 &5633209979457551608 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Demos/MovementScene.unity b/Assets/Scenes/Demos/MovementScene.unity index 1a205ac..0d41450 100644 --- a/Assets/Scenes/Demos/MovementScene.unity +++ b/Assets/Scenes/Demos/MovementScene.unity @@ -936,22 +936,6 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 1818923263116056088, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} - propertyPath: jumpDuration - value: 0.02 - objectReference: {fileID: 0} - - target: {fileID: 1818923263116056088, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} - propertyPath: minimumHeight - value: 0.1 - objectReference: {fileID: 0} - - target: {fileID: 1818923263116056088, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} - propertyPath: wallMaxDistance - value: 5 - objectReference: {fileID: 0} - - target: {fileID: 1818923263116056088, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} - propertyPath: wallGravityDownForce - value: 3 - objectReference: {fileID: 0} - target: {fileID: 5633209979457551608, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} propertyPath: m_Name value: DebugPlayerPrefab @@ -1000,10 +984,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8720404377688450390, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} - propertyPath: m_LocalPosition.x - value: -2.12 - objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} --- !u!1 &1257935739 diff --git a/Assets/Scripts/Network/Game/SpawnManager.cs b/Assets/Scripts/Network/Game/SpawnManager.cs index b80fe37..7744d47 100644 --- a/Assets/Scripts/Network/Game/SpawnManager.cs +++ b/Assets/Scripts/Network/Game/SpawnManager.cs @@ -31,6 +31,8 @@ public class SpawnManager : NetworkBehaviour { } else { // Spawn as player _runner = Instantiate(runnerPrefab, runnersSpawnPoints[runnersSpawned], Quaternion.identity).gameObject; + //Recreate Inventory + _runner.GetComponentInChildren().UpdateEquips(playerData.pInv.NetworkItemList, this.gameObject.GetComponent().ItemDict); _runner.GetComponent().SpawnAsPlayerObject(NetworkManager.Singleton.LocalClientId); // Increment runners @@ -49,6 +51,7 @@ public class SpawnManager : NetworkBehaviour { if (SceneManager.GetActiveScene().buildIndex == 3) { // Mountain Level runnersSpawnPoints = SpawnPoints.Instance.getRunnerSpawnPoints(0); kingSpawnPoint = SpawnPoints.Instance.getKingSpawnPoint(0); + } } @@ -65,6 +68,8 @@ public class SpawnManager : NetworkBehaviour { } else { // Spawn as player _runner = Instantiate(runnerPrefab, runnersSpawnPoints[runnersSpawned], Quaternion.identity).gameObject; + //Recreate Inventory + _runner.GetComponentInChildren().UpdateEquips(playerData.pInv.NetworkItemList, this.gameObject.GetComponent().ItemDict); _runner.GetComponent().SpawnAsPlayerObject(clientId, null, true); // Increment runners diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dWallRun.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dWallRun.cs index 5589355..6b5772f 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dWallRun.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dWallRun.cs @@ -151,12 +151,32 @@ public class dWallRun : NetworkBehaviour Vector3 moveToSet = alongWall * vertical * playerMovementController.PlayerSpeed() * Time.deltaTime;// * wallSpeedMultiplier; Vector3 velNorm = playerMovementController.vel; velNorm.Normalize(); + moveToSet = new Vector3(moveToSet.x * -velNorm.x, moveToSet.y, moveToSet.z * -velNorm.z); + + Vector3 moveToSetNorm = moveToSet; + moveToSetNorm.Normalize(); + + if((moveToSetNorm.x < 0 && velNorm.x > 0)){ + moveToSet.x = (moveToSet.x * -velNorm.x); + Debug.Log("x"); + } + else if((moveToSetNorm.x > 0 && velNorm.x < 0) ){ + moveToSet.x = (-moveToSet.x * -velNorm.x); + } + + if((moveToSetNorm.z < 0 && velNorm.z > 0)){ + moveToSet.z = (moveToSet.z * -velNorm.z); + Debug.Log("z"); + } + else if((moveToSetNorm.z > 0 && velNorm.z < 0)){ + moveToSet.z = (-moveToSet.z * -velNorm.z); + } + moveToSet.y = 0; playerMovementController.SetPlayerVelocity(moveToSet); - Debug.Log(moveToSet); isWallRunning = true; } } diff --git a/Assets/Scripts/PlayerScripts/MovementAbilities/WallRun.cs b/Assets/Scripts/PlayerScripts/MovementAbilities/WallRun.cs index 4f9c68c..bc284cf 100644 --- a/Assets/Scripts/PlayerScripts/MovementAbilities/WallRun.cs +++ b/Assets/Scripts/PlayerScripts/MovementAbilities/WallRun.cs @@ -151,12 +151,32 @@ public class WallRun : NetworkBehaviour Vector3 moveToSet = alongWall * vertical * playerMovementController.PlayerSpeed() * Time.deltaTime;// * wallSpeedMultiplier; Vector3 velNorm = playerMovementController.vel; velNorm.Normalize(); + moveToSet = new Vector3(moveToSet.x * -velNorm.x, moveToSet.y, moveToSet.z * -velNorm.z); + + Vector3 moveToSetNorm = moveToSet; + moveToSetNorm.Normalize(); + + if((moveToSetNorm.x < 0 && velNorm.x > 0)){ + moveToSet.x = (moveToSet.x * -velNorm.x); + Debug.Log("x"); + } + else if((moveToSetNorm.x > 0 && velNorm.x < 0) ){ + moveToSet.x = (-moveToSet.x * -velNorm.x); + } + + if((moveToSetNorm.z < 0 && velNorm.z > 0)){ + moveToSet.z = (moveToSet.z * -velNorm.z); + Debug.Log("z"); + } + else if((moveToSetNorm.z > 0 && velNorm.z < 0)){ + moveToSet.z = (-moveToSet.z * -velNorm.z); + } + moveToSet.y = 0; playerMovementController.SetPlayerVelocity(moveToSet); - Debug.Log(moveToSet); isWallRunning = true; } } diff --git a/Assets/Scripts/PlayerScripts/PlayerInventory.cs b/Assets/Scripts/PlayerScripts/PlayerInventory.cs index 63080c9..7e3ec80 100644 --- a/Assets/Scripts/PlayerScripts/PlayerInventory.cs +++ b/Assets/Scripts/PlayerScripts/PlayerInventory.cs @@ -7,7 +7,7 @@ public class PlayerInventory : NetworkBehaviour { //List of items - [SerializeField] private Dictionary playerItemDict = new Dictionary(); + [SerializeField] Dictionary playerItemDict = new Dictionary(); public Dictionary PlayerItemDict{ get{ return playerItemDict; } } @@ -18,11 +18,9 @@ public class PlayerInventory : NetworkBehaviour } //Scripts public PlayerStats pStats; - public InventoryManager invMan; void Awake(){ - pStats = GetComponent(); - invMan = FindObjectOfType(); + pStats = GetComponent(); } //Adds player Item to a dictionary @@ -69,14 +67,9 @@ public class PlayerInventory : NetworkBehaviour } //Equips All items in list at start of next scene - public void UpdateEquips(){ - if(invMan != null){ - foreach(string itemName in networkItemList){ - invMan.ItemDict[itemName].Equip(pStats, this.gameObject); - } - } - else{ - Debug.Log("invMan is currently not set or disabled"); + public void UpdateEquips(List items, Dictionary allItems){ + foreach(string itemName in items){ + AddItem(allItems[itemName]); } } diff --git a/Assets/Scripts/PlayerScripts/PlayerMovement.cs b/Assets/Scripts/PlayerScripts/PlayerMovement.cs index 436e3fd..e342fc0 100644 --- a/Assets/Scripts/PlayerScripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerScripts/PlayerMovement.cs @@ -291,13 +291,13 @@ public class PlayerMovement : NetworkBehaviour Vector3 lastCamPos = new Vector3(0,0,0); Vector3 rotOffset = transform.localEulerAngles; if(moveController.enabled){ - transform.parent.Rotate(Vector3.up * sensitivity * Time.deltaTime * Input.GetAxis("Mouse X")); + transform.parent.Rotate(Vector3.up * sensitivity * Time.deltaTime * Input.GetAxis("Mouse X")); - camRotation.x -= Input.GetAxis("Mouse Y") * sensitivity * Time.deltaTime; - camRotation.x = Mathf.Clamp(camRotation.x, minAngle, maxAngle); + camRotation.x -= Input.GetAxis("Mouse Y") * sensitivity * Time.deltaTime; + camRotation.x = Mathf.Clamp(camRotation.x, minAngle, maxAngle); - cam.transform.localEulerAngles = camRotation; + cam.transform.localEulerAngles = camRotation; } } diff --git a/Assets/Scripts/PlayerScripts/PlayerStats.cs b/Assets/Scripts/PlayerScripts/PlayerStats.cs index 3927459..f08a7ad 100644 --- a/Assets/Scripts/PlayerScripts/PlayerStats.cs +++ b/Assets/Scripts/PlayerScripts/PlayerStats.cs @@ -6,63 +6,63 @@ using UnityEngine.Assertions; public class PlayerStats : MonoBehaviour { //Maximum possible player speed - private float maxVel = 25.0f; + [SerializeField] private float maxVel = 25.0f; public float MaxVel{ get{ return maxVel; } set{ maxVel = value; } } //Minimum possible player speed - private float minVel = 2.0f; + [SerializeField] private float minVel = 2.0f; public float MinVel{ get{ return minVel; } set{ minVel = value; } } //Current player speed - private float curVel = 0.0f; + [SerializeField] private float curVel = 0.0f; public float CurVel{ get{ return curVel; } set{ curVel = value; } } //Player Acceleration - private float acc = 0.1f; + [SerializeField] private float acc = 0.1f; public float Acc{ get{ return acc; } set{ acc = value; } } //Player Jump power - private float jumpPow = 300.0f; + [SerializeField] private float jumpPow = 300.0f; public float JumpPow{ get{ return jumpPow; } set{ jumpPow = value; } } //Players Number of Jumps - private int jumpNum = 2; + [SerializeField] private int jumpNum = 2; public int JumpNum{ get{ return jumpNum; } set{ jumpNum = value; } } //Player Traction - private float traction = 3.0f; + [SerializeField] private float traction = 3.0f; public float Traction{ get{ return traction; } set{ traction = value; } } //Player Kick Power - private float kickPow = 100.0f; + [SerializeField] private float kickPow = 100.0f; public float KickPow{ get{ return kickPow; } set{ kickPow = value; } } //Player Recovery Time When Knocked Down - private float recovTime = 3.0f; + [SerializeField] private float recovTime = 3.0f; public float RecovTime{ get{ return recovTime; } set{ recovTime = value; } @@ -70,55 +70,55 @@ public class PlayerStats : MonoBehaviour //MAY BE UNNECCESARY DEPENDING ON HOW GLIDER TURNS OUT //Gravity Affecting the player - private float playerGrav = 20.0f; + [SerializeField] private float playerGrav = 20.0f; public float PlayerGrav{ get{ return playerGrav; } set{ playerGrav = value; } } //If The Player Has Blink - private bool hasBlink = false; + [SerializeField] private bool hasBlink = false; public bool HasBlink{ get{ return hasBlink; } set{ hasBlink = value; } } //If The Player Has Glider - private bool hasGlider = false; + [SerializeField] private bool hasGlider = false; public bool HasGlider{ get{ return hasGlider; } set{ hasGlider = value; } } //If The Player Has Grapple - private bool hasGrapple = false; + [SerializeField] private bool hasGrapple = false; public bool HasGrapple{ get{ return hasGrapple; } set{ hasGrapple = value; } } //If The Player Has Wallrun - private bool hasWallrun = true; + [SerializeField] private bool hasWallrun = false; public bool HasWallrun{ get{ return hasWallrun; } set{ hasWallrun = value; } } //If The Player Has Nitro - private bool hasNitro = false; + [SerializeField] private bool hasNitro = false; public bool HasNitro{ get{ return hasNitro; } set{ hasNitro = value; } } //If The Player Has Dash - private bool hasDash; + [SerializeField] private bool hasDash = false; public bool HasDash{ get{ return hasDash; } set{ hasDash = value; } } - private int playerPoints = 15; + [SerializeField] private int playerPoints = 15; public int PlayerPoints{ get{ return playerPoints; } set{ playerPoints = value; } diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 5201177..048ed1e 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -30,7 +30,7 @@ EditorUserSettings: value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb flags: 0 RecentlyUsedScenePath-8: - value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb + value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb flags: 0 RecentlyUsedScenePath-9: value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb