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
This commit is contained in:
Melbyj1125
2021-10-25 03:38:56 -05:00
parent cc99ababff
commit 702bb555f0
33 changed files with 290 additions and 319 deletions

View File

@@ -20,7 +20,7 @@ public class Item: ScriptableObject {
public float playerGravM;
public int costM;
public virtual void Equip(PlayerStats p){
public virtual void Equip(PlayerStats p, GameObject player){
if(maxVelM != 0){
p.MaxVel += maxVelM;
}
@@ -50,7 +50,7 @@ public class Item: ScriptableObject {
}
}
public virtual void Unequip(PlayerStats p){
public virtual void Unequip(PlayerStats p, GameObject player){
if(maxVelM != 0){
p.MaxVel -= maxVelM;
}

View File

@@ -33,3 +33,4 @@ MonoBehaviour:
hasNitroM: 0
hasDashM: 0
cooldownM: 0
scriptM: {fileID: 11500000, guid: 5162a84172831f4449df60b9ad0ce22f, type: 3}

View File

@@ -33,3 +33,4 @@ MonoBehaviour:
hasNitroM: 0
hasDashM: 0
cooldownM: 0
scriptM: {fileID: 11500000, guid: 535009eaa735a4c4e95c6fc270e32741, type: 3}

View File

@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CreateAssetMenu]
public class SpecialItem : Item
@@ -12,8 +13,9 @@ public class SpecialItem : Item
public bool hasNitroM;
public bool hasDashM;
public float cooldownM;
public MonoScript scriptM;
public override void Equip(PlayerStats p){
public override void Equip(PlayerStats p, GameObject player){
if(maxVelM != 0){
p.MaxVel += maxVelM;
}
@@ -59,9 +61,12 @@ public class SpecialItem : Item
if(hasDashM != false){
p.HasDash = hasDashM;
}
if(scriptM != null){
player.AddComponent(scriptM.GetClass());
}
}
public override void Unequip(PlayerStats p){
public override void Unequip(PlayerStats p, GameObject player){
if(maxVelM != 0){
p.MaxVel -= maxVelM;
}
@@ -89,23 +94,26 @@ public class SpecialItem : Item
if(playerGravM != 0){
p.PlayerGrav -= playerGravM;
}
if(hasWallrunM != true){
p.HasWallrun = hasWallrunM;
if(hasWallrunM != false){
p.HasWallrun = false;
}
if(hasBlinkM != true){
p.HasBlink = hasBlinkM;
if(hasBlinkM != false){
p.HasBlink = false;
}
if(hasGrappleM != true){
p.HasGrapple = hasGrappleM;
if(hasGrappleM != false){
p.HasGrapple = false;
}
if(hasGliderM != true){
p.HasGlider = hasGliderM;
if(hasGliderM != false){
p.HasGlider = false;
}
if(hasNitroM != true){
p.HasNitro = hasNitroM;
if(hasNitroM != false){
p.HasNitro = false;
}
if(hasDashM != true){
p.HasDash = hasDashM;
if(hasDashM != false){
p.HasDash = false;
}
if(scriptM != null){
Destroy(player.GetComponent(scriptM.GetClass()));
}
}
}

View File

@@ -1,15 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WallRunItem : Item
{
public void Equip(PlayerStats p){
p.HasWallrun = true;
}
public void Unequip(PlayerStats p)
{
p.HasWallrun = false;
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 80dbcf4212f11a74ebd5289c2b5eb309
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: