diff --git a/Assets/Scenes/Demos/InventorySelection.unity b/Assets/Scenes/Demos/InventorySelection.unity index e266dac..2a6a20d 100644 --- a/Assets/Scenes/Demos/InventorySelection.unity +++ b/Assets/Scenes/Demos/InventorySelection.unity @@ -815,6 +815,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 4367973138255890080, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} + propertyPath: cam + value: + objectReference: {fileID: 2127720128} - target: {fileID: 5633209979457551608, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} propertyPath: m_Name value: DebugPlayerPrefab @@ -1380,3 +1384,8 @@ RectTransform: m_AnchoredPosition: {x: 283, y: -71} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} +--- !u!20 &2127720128 stripped +Camera: + m_CorrespondingSourceObject: {fileID: 4654986889578046791, guid: 362ca97b75c291a47ab81d628a81f440, type: 3} + m_PrefabInstance: {fileID: 885603619} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Scenes/Demos/MovementScene.unity b/Assets/Scenes/Demos/MovementScene.unity index e8f622b..51366ec 100644 --- a/Assets/Scenes/Demos/MovementScene.unity +++ b/Assets/Scenes/Demos/MovementScene.unity @@ -544,7 +544,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 724425600} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 2.0000002, y: 2.1131458, z: -0.73} + m_LocalPosition: {x: 2.0000002, y: 2.1131458, z: 33.4} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1650963653} diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dBlink.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dBlink.cs index 2e387d0..b0ddf48 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dBlink.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dBlink.cs @@ -9,7 +9,7 @@ public class dBlink : NetworkBehaviour{ // Start is called before the first frame update - private Camera cam; + public Camera cam; public CharacterController controller; //Blink Variables private LineRenderer beam; @@ -36,12 +36,11 @@ public class dBlink : NetworkBehaviour{ // Grab the main camera. //camera transform - cam = GetComponentInChildren(); } //ADJUST SO DISTANCE IS DETERMINED BY SCROLL WHEEL //blinks the player forwards - private void BlinkMove() + public void BlinkMove() { //if (!IsLocalPlayer) { return; } diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dDash.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dDash.cs index f078d9d..e37d701 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dDash.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dDash.cs @@ -22,21 +22,22 @@ public class dDash : NetworkBehaviour{ //UPDATE CHECK FOR MOVEMENT ONLY WHEN DASHING void FixedUpdate(){ //if (!IsLocalPlayer) { return; } - - if (Input.GetKeyDown(KeyCode.E)) - { - currentDashTime = 0; + if(characterController.enabled == true){ + if (Input.GetKeyDown(KeyCode.E)) + { + currentDashTime = 0; + } + if(currentDashTime < maxDashTime) + { + moveDirection = transform.forward * dashDistance; + currentDashTime += dashStoppingSpeed; + } + else + { + moveDirection = Vector3.zero; + } + characterController.Move(moveDirection * Time.deltaTime * dashSpeed); } - if(currentDashTime < maxDashTime) - { - moveDirection = transform.forward * dashDistance; - currentDashTime += dashStoppingSpeed; - } - else - { - moveDirection = Vector3.zero; - } - characterController.Move(moveDirection * Time.deltaTime * dashSpeed); } } \ No newline at end of file diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dWallRun.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dWallRun.cs index 936abef..b359430 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dWallRun.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/DebugItems/dWallRun.cs @@ -41,7 +41,6 @@ public class dWallRun : NetworkBehaviour bool CanWallRun() { float verticalAxis = Input.GetAxisRaw("Vertical"); - return !isPlayergrounded() && verticalAxis > 0 && VerticalCheck(); } @@ -155,6 +154,7 @@ public class dWallRun : NetworkBehaviour playerMovementController.SetPlayerVelocity(moveToSet); //Debug.Log("On Wall"); isWallRunning = true; + Debug.Log("Is Wallrunning"); } } diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs index c97c08d..7385db8 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs @@ -78,7 +78,8 @@ public class dPlayerMovement : NetworkBehaviour private Vector3 up; private bool qDown; - //Kick Variables + //Blink + private dBlink blink; void Awake() { @@ -93,6 +94,8 @@ public class dPlayerMovement : NetworkBehaviour //Wallrun wallRun = gameObject.GetComponent(); + blink = gameObject.GetComponent(); + up = this.gameObject.GetComponentInParent().up; } @@ -155,12 +158,16 @@ public class dPlayerMovement : NetworkBehaviour //TEMP FOR TESTING RAGDOLL //Right Click to ragdoll the player - if (Input.GetMouseButton(1) && heldDown == false){ - getHit(new Vector3(vel.x, 0, vel.z), 30); - heldDown = true; - } - if(!Input.GetMouseButton(1)){ - heldDown = false; + // if (Input.GetMouseButton(1) && heldDown == false){ + // getHit(new Vector3(vel.x, 0, vel.z), 30); + // heldDown = true; + // } + // if(!Input.GetMouseButton(1)){ + // heldDown = false; + // } + + if(pStats.HasBlink == true){ + blink.BlinkMove(); } //TEMP FOR TESTING diff --git a/Assets/Scripts/PlayerScripts/ItemScripts/InventoryManager.cs b/Assets/Scripts/PlayerScripts/ItemScripts/InventoryManager.cs index 061f336..41df7a0 100644 --- a/Assets/Scripts/PlayerScripts/ItemScripts/InventoryManager.cs +++ b/Assets/Scripts/PlayerScripts/ItemScripts/InventoryManager.cs @@ -4,7 +4,10 @@ using UnityEngine; public class InventoryManager : MonoBehaviour { + //allItems array public Item[] allItems; + + //Item list private List itemList; public List ItemList{ get{ return itemList; } @@ -13,8 +16,8 @@ public class InventoryManager : MonoBehaviour void Awake(){ + //Gets Items in Resource Folder allItems = Resources.LoadAll("ItemObjects"); - itemList = new List(allItems); } } diff --git a/Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems.meta b/Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems.meta new file mode 100644 index 0000000..f0d8719 --- /dev/null +++ b/Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 08ce0ad440e9031429d13663cf77c6f0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Blink.asset b/Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems/Blink.asset similarity index 100% rename from Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Blink.asset rename to Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems/Blink.asset diff --git a/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Blink.asset.meta b/Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems/Blink.asset.meta similarity index 100% rename from Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Blink.asset.meta rename to Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems/Blink.asset.meta diff --git a/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Nitro.asset b/Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems/Nitro.asset similarity index 100% rename from Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Nitro.asset rename to Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems/Nitro.asset diff --git a/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Nitro.asset.meta b/Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems/Nitro.asset.meta similarity index 100% rename from Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Nitro.asset.meta rename to Assets/Scripts/PlayerScripts/ItemScripts/ObsoleteItems/Nitro.asset.meta diff --git a/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Dash.asset b/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Dash.asset new file mode 100644 index 0000000..161398b --- /dev/null +++ b/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Dash.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 220c578e08133f54a95a442eb87b3702, type: 3} + m_Name: Dash + m_EditorClassIdentifier: + id: 11 + itemName: Dash + description: Quickly Moves the player forwards + maxVelM: 0 + minVelM: 0 + curVelM: 0 + accM: 0 + jumpPowM: 0 + jumpNumM: 0 + tractionM: 0 + kickPowM: 0 + recovTimeM: 0 + playerGravM: 0 + costM: 5 + hasWallrunM: 0 + hasBlinkM: 0 + hasGrappleM: 0 + hasGliderM: 0 + hasNitroM: 0 + hasDashM: 1 + cooldownM: 15 diff --git a/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Dash.asset.meta b/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Dash.asset.meta new file mode 100644 index 0000000..cdefc23 --- /dev/null +++ b/Assets/Scripts/PlayerScripts/ItemScripts/Resources/ItemObjects/Dash.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4399d7276b3edf446ac51c5145539a5e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerScripts/PlayerInventory.cs b/Assets/Scripts/PlayerScripts/PlayerInventory.cs index f716c6b..5d02252 100644 --- a/Assets/Scripts/PlayerScripts/PlayerInventory.cs +++ b/Assets/Scripts/PlayerScripts/PlayerInventory.cs @@ -17,28 +17,35 @@ public class PlayerInventory : MonoBehaviour } + //Add item to player Inventory public void AddItem(Item item, bool ableToAdd){ if(!items.Contains(item) && ableToAdd){ Debug.Log("Item Added"); + + //Add item to player inventroy list items.Add(item); + //Equip item item.Equip(pStats, this.gameObject); } else if(!ableToAdd && !items.Contains(item)){ + //Item cannot be added Debug.Log("Item Cannot Be Added"); } else{ + //If player already has the item it removes it Debug.Log("Item Removed"); RemoveItem(item); } } - + //Remove Item player inv public void RemoveItem(Item item){ if(items.Remove(item)){ item.Unequip(pStats, this.gameObject); } } + //GetItems public List GetItems(){ return items; } diff --git a/Assets/Scripts/PlayerScripts/PlayerMovement.cs b/Assets/Scripts/PlayerScripts/PlayerMovement.cs index 4e187e7..10a3fa5 100644 --- a/Assets/Scripts/PlayerScripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerScripts/PlayerMovement.cs @@ -101,7 +101,7 @@ public class PlayerMovement : NetworkBehaviour // Don't do movement unless this is the local player controlling it // Otherwise we let the server handle moving us - //if (!IsLocalPlayer) { return; } + if (!IsLocalPlayer) { return; } // Don't lock the cursor multiple times if this isn't the local player // Also don't want to lock the cursor for the king @@ -151,20 +151,6 @@ public class PlayerMovement : NetworkBehaviour //Debug.LogWarning("MoveController is either Disabled or wasn't retrieved correctly"); } - //TESTING RAGDOLL STUFF NEEDS SOME WORK - //Checks if player should respawn - //Respawn(); - - //if (Input.GetMouseButton(1) && heldDown == false){ - // getHit(new Vector3(vel.x, 0, vel.z), 30); - // heldDown = true; - //} - - - if(!Input.GetMouseButton(1)){ - heldDown = false; - } - //TEMP FOR TESTING //Checks if player should respawn Respawn(); @@ -189,6 +175,7 @@ public class PlayerMovement : NetworkBehaviour //Gravity Gravity(); + //Adds persisting momentum to player driftVel = Vector3.Lerp(driftVel, vel, pStats.Traction * Time.deltaTime); //Moving outside basic wasd diff --git a/Assets/Scripts/PlayerScripts/PlayerStats.cs b/Assets/Scripts/PlayerScripts/PlayerStats.cs index fbb8fa2..d532b3e 100644 --- a/Assets/Scripts/PlayerScripts/PlayerStats.cs +++ b/Assets/Scripts/PlayerScripts/PlayerStats.cs @@ -133,9 +133,9 @@ public class PlayerStats : MonoBehaviour Debug.Assert((minVel >= 0), "minVel cannot be below zero"); Debug.Assert((curVel >= 0), "curVel cannot be below zero"); Debug.Assert((jumpPow >= 0), "jumpPow cannot be below zero"); - Debug.Assert((jumpNum >= 2), "jumpNum cannot be below zero"); + Debug.Assert((jumpNum >= 2), "jumpNum cannot be below 2"); Debug.Assert((traction >= 0), "traction cannot be below zero"); - //Debug.Assert((kickPow >= 0), "Playerpoints cannot be below zero"); + Debug.Assert((kickPow >= 0), "Playerpoints cannot be below zero"); Debug.Assert((recovTime >= 0), "recovTime cannot be below zero"); Debug.Assert((playerGrav >= 0), "playerGrav cannot be below zero"); Debug.Assert((playerPoints >= 0), "Playerpoints cannot be below zero"); diff --git a/Assets/Scripts/SetInvScene/InvSceneSettings.cs b/Assets/Scripts/SetInvScene/InvSceneSettings.cs index f69a8a8..5f54989 100644 --- a/Assets/Scripts/SetInvScene/InvSceneSettings.cs +++ b/Assets/Scripts/SetInvScene/InvSceneSettings.cs @@ -46,22 +46,30 @@ public class InvSceneSettings : MonoBehaviour if(itemOptPrefab != null){ foreach(Item item in invMan.ItemList){ + //Positioning Buttons if(index < 5){ position = new Vector3(((index)),3,0); } else{ position = new Vector3(((index-5)),2,0); } + + //Creates Button var iOpt = Instantiate(itemOptPrefab, position, Quaternion.identity); + //Uses Item Variables to update button iOpt.name = item.itemName; iOpt.transform.SetParent(GameObject.Find("Items").transform); iOpt.transform.localScale = new Vector3(1.5f,1.5f,1.5f); + + //Button Adds item if it can iOpt.GetComponent