Added Item Cost and Max Points

Added Glide
Added Item adding verification
This commit is contained in:
Melbyj1125
2021-10-18 12:19:44 -05:00
parent a42e802ace
commit 39bc66244e
25 changed files with 945 additions and 327 deletions

View File

@@ -18,8 +18,9 @@ public class Item: ScriptableObject {
public float kickPowM;
public float recovTimeM;
public float playerGravM;
public int costM;
public void Equip(PlayerStats p){
public virtual void Equip(PlayerStats p){
if(maxVelM != 0){
p.MaxVel += maxVelM;
}
@@ -49,7 +50,7 @@ public class Item: ScriptableObject {
}
}
public void Unequip(PlayerStats p){
public virtual void Unequip(PlayerStats p){
if(maxVelM != 0){
p.MaxVel -= maxVelM;
}

View File

@@ -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: Blink
m_EditorClassIdentifier:
id: 9
itemName: Blink
description: Allows Blinking 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: 1
hasGrappleM: 0
hasGliderM: 0
hasNitroM: 0
hasDashM: 0
cooldownM: 0

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f3ec80a746c12614db0a11da845e3815
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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: Glider
m_EditorClassIdentifier:
id: 7
itemName: Glider
description: Player Will Fall slower
maxVelM: 0
minVelM: 0
curVelM: 0
accM: 0
jumpPowM: 0
jumpNumM: 0
tractionM: 0
kickPowM: 0
recovTimeM: 0
playerGravM: 0
costM: 7
hasWallrunM: 0
hasBlinkM: 0
hasGrappleM: 0
hasGliderM: 1
hasNitroM: 0
hasDashM: 0
cooldownM: 10

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8fe830ac457225a4ab1031a499db94fc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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: Grapple
m_EditorClassIdentifier:
id: 8
itemName: Grapple
description: Allows the use of a grapple
maxVelM: 0
minVelM: 0
curVelM: 0
accM: 0
jumpPowM: 0
jumpNumM: 0
tractionM: 0
kickPowM: 0
recovTimeM: 0
playerGravM: 0
costM: 4
hasWallrunM: 0
hasBlinkM: 0
hasGrappleM: 1
hasGliderM: 0
hasNitroM: 0
hasDashM: 0
cooldownM: 0

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d48485317ff858c4189d9c3a24830f42
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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: Nitro
m_EditorClassIdentifier:
id: 10
itemName: Nitro
description: Boosts player speed
maxVelM: 0
minVelM: 0
curVelM: 0
accM: 0
jumpPowM: 0
jumpNumM: 0
tractionM: 0
kickPowM: 0
recovTimeM: 0
playerGravM: 0
costM: 6
hasWallrunM: 0
hasBlinkM: 0
hasGrappleM: 0
hasGliderM: 0
hasNitroM: 1
hasDashM: 0
cooldownM: 0

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b91f668477f6b3244b3fea3204e6cd87
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -25,3 +25,4 @@ MonoBehaviour:
kickPowM: 0
recovTimeM: 20
playerGravM: 0
costM: 5

View File

@@ -25,3 +25,4 @@ MonoBehaviour:
kickPowM: 0
recovTimeM: 0
playerGravM: 0
costM: 6

View File

@@ -25,3 +25,4 @@ MonoBehaviour:
kickPowM: 0
recovTimeM: 0
playerGravM: 0
costM: 6

View File

@@ -25,3 +25,4 @@ MonoBehaviour:
kickPowM: 30
recovTimeM: 0
playerGravM: 0
costM: 3

View File

@@ -25,3 +25,4 @@ MonoBehaviour:
kickPowM: 0
recovTimeM: 0
playerGravM: 0
costM: 5

View File

@@ -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: Wall Run
m_EditorClassIdentifier:
id: 6
itemName: Wall Run
description: Allows player to run on walls
maxVelM: 0
minVelM: 0
curVelM: 0
accM: 0
jumpPowM: 0
jumpNumM: 0
tractionM: 0
kickPowM: 0
recovTimeM: 0
playerGravM: 0
costM: 4
hasWallrunM: 1
hasBlinkM: 0
hasGrappleM: 0
hasGliderM: 0
hasNitroM: 0
hasDashM: 0
cooldownM: 0

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 82260a3a76214e04eafa1d267c1480fa
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -2,6 +2,111 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class SpecialItem : Item
{
public bool hasWallrunM;
public bool hasBlinkM;
public bool hasGrappleM;
public bool hasGliderM;
public bool hasNitroM;
public bool hasDashM;
public float cooldownM;
public override void Equip(PlayerStats p){
if(maxVelM != 0){
p.MaxVel += maxVelM;
}
if(minVelM != 0){
p.MinVel += minVelM;
}
if(curVelM != 0){
p.CurVel += curVelM;
}
if(accM != 0){
p.Acc += accM;
}
if(jumpPowM != 0){
p.JumpPow += jumpPowM;
}
if(jumpNumM != 0){
p.JumpNum += jumpNumM;
}
if(tractionM != 0){
p.Traction += tractionM;
}
if(kickPowM != 0){
p.KickPow += kickPowM;
}
if(playerGravM != 0){
p.PlayerGrav += playerGravM;
}
if(hasWallrunM != false){
p.HasWallrun = hasWallrunM;
}
if(hasBlinkM != false){
p.HasBlink = hasBlinkM;
}
if(hasGrappleM != false){
p.HasGrapple = hasGrappleM;
}
if(hasGliderM != false){
p.HasGlider = hasGliderM;
}
if(hasNitroM != false){
p.HasNitro = hasNitroM;
}
if(hasDashM != false){
p.HasDash = hasDashM;
}
}
public override void Unequip(PlayerStats p){
if(maxVelM != 0){
p.MaxVel -= maxVelM;
}
if(minVelM != 0){
p.MinVel -= minVelM;
}
if(curVelM != 0){
p.CurVel -= curVelM;
}
if(accM != 0){
p.Acc -= accM;
}
if(jumpPowM != 0){
p.JumpPow -= jumpPowM;
}
if(jumpNumM != 0){
p.JumpNum -= jumpNumM;
}
if(tractionM != 0){
p.Traction -= tractionM;
}
if(kickPowM != 0){
p.KickPow -= kickPowM;
}
if(playerGravM != 0){
p.PlayerGrav -= playerGravM;
}
if(hasWallrunM != true){
p.HasWallrun = hasWallrunM;
}
if(hasBlinkM != true){
p.HasBlink = hasBlinkM;
}
if(hasGrappleM != true){
p.HasGrapple = hasGrappleM;
}
if(hasGliderM != true){
p.HasGlider = hasGliderM;
}
if(hasNitroM != true){
p.HasNitro = hasNitroM;
}
if(hasDashM != true){
p.HasDash = hasDashM;
}
}
}

View File

@@ -4,6 +4,7 @@ using UnityEngine;
public class PlayerInventory : MonoBehaviour
{
//List of items
[SerializeField] List<Item> items;
@@ -12,15 +13,19 @@ public class PlayerInventory : MonoBehaviour
void Awake(){
pStats = GetComponent<PlayerStats>();
DontDestroyOnLoad(this.gameObject);
}
public void AddItem(Item item){
if(!items.Contains(item)){
public void AddItem(Item item, bool ableToAdd){
if(!items.Contains(item) && ableToAdd){
Debug.Log("Item Added");
items.Add(item);
item.Equip(pStats);
}
else if(!ableToAdd && !items.Contains(item)){
Debug.Log("Item Cannot Be Added");
}
else{
Debug.Log("Item Removed");
RemoveItem(item);
@@ -41,5 +46,9 @@ public class PlayerInventory : MonoBehaviour
}
}
public List<Item> GetItems(){
return items;
}
}

View File

@@ -64,7 +64,7 @@ public class PlayerMovement : MonoBehaviour
void Awake(){
//Initialize Components
moveController = GetComponentInChildren<CharacterController>();
moveController = GetComponent<CharacterController>();
pStats = GetComponent<PlayerStats>();
ignoreP = LayerMask.GetMask("Player");
@@ -74,7 +74,7 @@ public class PlayerMovement : MonoBehaviour
beam.enabled = false;
//camera transform
cam = GetComponent<Camera>();
cam = GetComponentInChildren<Camera>();
//Wallrun
//wallRun = gameObject.GetComponent<WallRun>();
@@ -84,18 +84,16 @@ public class PlayerMovement : MonoBehaviour
void Start(){
Cursor.lockState = CursorLockMode.Locked;
distToGround = GetComponentInChildren<Collider>().bounds.extents.y;
distToGround = GetComponent<Collider>().bounds.extents.y;
}
// Update is called once per frame
void FixedUpdate(){
//input controls for movement
InputController();
//Controls for camera
Rotate();
if(moveController.enabled == true){
//input controls for movement
@@ -206,7 +204,7 @@ public class PlayerMovement : MonoBehaviour
if(Input.GetAxis("Jump")==0) jumpPressed = false;
}
public bool GetJumpPressed() {
public bool GetJumpPressed(){
return jumpPressed;
}
@@ -246,8 +244,32 @@ public class PlayerMovement : MonoBehaviour
//Gravity Function for adjusting y-vel due to wallrun/glide/etc
private void Gravity(){
//Normal Gravity
vel.y -= pStats.PlayerGrav * Time.deltaTime;
//Temp Values for Glider
float tempTraction = 0.0f;
bool tempSet = false;
//ADD CHECKER FOR GLIDER WHEN FULLY IMPLEMENTED
if(jumpPressed && pStats.HasGlider){
vel.y -= (pStats.PlayerGrav-18) * Time.deltaTime;
if(tempSet == false){
tempTraction = pStats.Traction;
pStats.Traction = 1.0f;
tempSet = true;
}
}
else{
if(tempSet == true){
pStats.Traction = tempTraction;
tempSet = false;
}
//Normal Gravity
vel.y -= pStats.PlayerGrav * Time.deltaTime;
}
//Wallrunning
if (pStats.HasWallrun) { wallRun.WallRunRoutine(); } //adjusted later if we are wallrunning
//If gliding

View File

@@ -5,6 +5,7 @@ using UnityEngine;
public class PlayerStats : MonoBehaviour
{
//Maximum possible player speed
[SerializeField]
private float maxVel = 25.0f;
public float MaxVel{
get{ return maxVel; }
@@ -12,6 +13,7 @@ public class PlayerStats : MonoBehaviour
}
//Minimum possible player speed
[SerializeField]
private float minVel = 2.0f;
public float MinVel{
get{ return minVel; }
@@ -19,6 +21,7 @@ public class PlayerStats : MonoBehaviour
}
//Current player speed
[SerializeField]
private float curVel = 0.0f;
public float CurVel{
get{ return curVel; }
@@ -26,6 +29,7 @@ public class PlayerStats : MonoBehaviour
}
//Player Jump power
[SerializeField]
private float acc = 0.1f;
public float Acc{
get{ return acc; }
@@ -33,6 +37,7 @@ public class PlayerStats : MonoBehaviour
}
//Player Jump power
[SerializeField]
private float jumpPow = 300.0f;
public float JumpPow{
get{ return jumpPow; }
@@ -40,6 +45,7 @@ public class PlayerStats : MonoBehaviour
}
//Players Number of Jumps
[SerializeField]
private int jumpNum = 2; ////// UPDATE TO 2 WHEN THE JUMP ISSUE IS FIXED
public int JumpNum{
get{ return jumpNum; }
@@ -47,6 +53,7 @@ public class PlayerStats : MonoBehaviour
}
//Player Traction
[SerializeField]
private float traction = 3.0f;
public float Traction{
get{ return traction; }
@@ -54,13 +61,15 @@ public class PlayerStats : MonoBehaviour
}
//Player Kick Power
[SerializeField]
private float kickPow;
public float KickPow{
get{ return kickPow; }
set{ kickPow = value; }
}
//Player Recovery Time When Knocked Down
//Player Recovery Time When Knocked Down
[SerializeField]
private float recovTime;
public float RecovTime{
get{ return recovTime; }
@@ -69,6 +78,7 @@ public class PlayerStats : MonoBehaviour
//MAY BE UNNECCESARY DEPENDING ON HOW GLIDER TURNS OUT
//Gravity Affecting the player
[SerializeField]
private float playerGrav = 20.0f;
public float PlayerGrav{
get{ return playerGrav; }
@@ -76,6 +86,7 @@ public class PlayerStats : MonoBehaviour
}
//If The Player Has Blink
[SerializeField]
private bool hasBlink = false;
public bool HasBlink{
get{ return hasBlink; }
@@ -83,6 +94,7 @@ public class PlayerStats : MonoBehaviour
}
//If The Player Has Glider
[SerializeField]
private bool hasGlider = false;
public bool HasGlider{
get{ return hasGlider; }
@@ -90,6 +102,7 @@ public class PlayerStats : MonoBehaviour
}
//If The Player Has Grapple
[SerializeField]
private bool hasGrapple = false;
public bool HasGrapple{
get{ return hasGrapple; }
@@ -97,9 +110,33 @@ public class PlayerStats : MonoBehaviour
}
//If The Player Has Wallrun
[SerializeField]
private bool hasWallrun = false;
public bool HasWallrun{
get{ return hasWallrun; }
set{ hasWallrun = value; }
}
//If The Player Has Nitro
[SerializeField]
private bool hasNitro = false;
public bool HasNitro{
get{ return hasNitro; }
set{ hasNitro = value; }
}
//If The Player Has Dash
[SerializeField]
private bool hasDash = false;
public bool HasDash{
get{ return hasDash; }
set{ hasDash = value; }
}
[SerializeField]
private int playerPoints = 15;
public int PlayerPoints{
get{ return playerPoints; }
set{ playerPoints = value; }
}
}