TheKingsRace/Assets/Scripts/PlayerScripts/ItemScripts/SpecialItem.cs
Melbyj1125 702bb555f0 Implemented Item Scripts into objects
Implemented Ragdoll kinda
There are some issues with getting hit while ragdolling that need to be
fixed
Adjusted Dash
Dash still needs some adjustments before being fully implemented
2021-10-25 03:38:56 -05:00

121 lines
2.9 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[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 MonoScript scriptM;
public override void Equip(PlayerStats p, GameObject player){
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;
}
if(scriptM != null){
player.AddComponent(scriptM.GetClass());
}
}
public override void Unequip(PlayerStats p, GameObject player){
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 = false;
}
if(hasBlinkM != false){
p.HasBlink = false;
}
if(hasGrappleM != false){
p.HasGrapple = false;
}
if(hasGliderM != false){
p.HasGlider = false;
}
if(hasNitroM != false){
p.HasNitro = false;
}
if(hasDashM != false){
p.HasDash = false;
}
if(scriptM != null){
Destroy(player.GetComponent(scriptM.GetClass()));
}
}
}