TheKingsRace/Assets/Scripts/PlayerScripts/ItemScripts/Item.cs
Melbyj1125 a42e802ace Created the Inventory Selection Scene
Added an ItemOption Prefab
Created Player Prefab
The player now will get their items in the inventory selection screen
Only within this scene will items be able to be added and removed
Updated player files to check for characterController being enabled
This will make it easier to implement the dual RigidBody system
2021-10-14 22:50:44 -05:00

82 lines
1.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu]
public class Item: ScriptableObject {
public int id;
public string itemName;
public string description;
[Space]
public float maxVelM;
public float minVelM;
public float curVelM;
public float accM;
public float jumpPowM;
public int jumpNumM;
public float tractionM;
public float kickPowM;
public float recovTimeM;
public float playerGravM;
public 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;
}
}
public 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;
}
}
}