Added dCoolDown for debugPlayer

-This change was required due to change in base cooldown script
This commit is contained in:
Evan Nydahl 2022-03-14 21:54:21 -05:00
parent 3ef7f7d0fb
commit 3481c5087a
6 changed files with 192 additions and 21 deletions

View File

@ -1173,7 +1173,7 @@ MonoBehaviour:
animator: {fileID: 0}
pStats: {fileID: 0}
mSM: {fileID: 0}
driver: {fileID: 5149733669485025623}
driver: {fileID: 5799787970557124338}
dashItem: {fileID: 11400000, guid: 3156de54e455b4348b2a6e79383383b0, type: 2}
--- !u!114 &1707207228499037412
MonoBehaviour:
@ -1223,7 +1223,7 @@ MonoBehaviour:
animator: {fileID: 0}
pStats: {fileID: 0}
mSM: {fileID: 0}
driver: {fileID: 5149733669485025623}
driver: {fileID: 5799787970557124338}
nitroItem: {fileID: 11400000, guid: a1c26807795a7ac4f83567455ce978ce, type: 2}
nitroVelBoost: 40
nitroAccBoost: 0.4
@ -4297,7 +4297,7 @@ GameObject:
- component: {fileID: 8453109168727161684}
- component: {fileID: 3525475281917159692}
- component: {fileID: 2091444927438964795}
- component: {fileID: 5149733669485025623}
- component: {fileID: 5799787970557124338}
m_Layer: 5
m_Name: PlayerCanvas
m_TagString: Untagged
@ -4387,7 +4387,7 @@ MonoBehaviour:
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &5149733669485025623
--- !u!114 &5799787970557124338
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -4396,7 +4396,7 @@ MonoBehaviour:
m_GameObject: {fileID: 6915241949826709613}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6c342edd8126e1449a50220a14c9333e, type: 3}
m_Script: {fileID: 11500000, guid: d6160e46c78b9ca45ab7fe770593a1ec, type: 3}
m_Name:
m_EditorClassIdentifier:
stats: {fileID: 1707207228499037468}

View File

@ -24,7 +24,7 @@ public class dDashStateManager : NetworkBehaviour
////Scripts Section
public PlayerStats pStats; // Player Stats
public dMoveStateManager mSM; // movement state manager
public CoolDown driver; // cooldown driver
public dCoolDown driver; // cooldown driver
//// AnimatorManagerScript
private dAnimationManager animationManager;
////

View File

@ -30,7 +30,7 @@ public class dNitroStateManager : NetworkBehaviour
////Scripts Section
public PlayerStats pStats; // Player Stats
public dMoveStateManager mSM; // move state manager
public CoolDown driver; // cooldown driver
public dCoolDown driver; // cooldown driver
//// AnimatorManagerScript
private dAnimationManager animationManager;
////

160
Assets/Scripts/dCoolDown.cs Normal file
View File

@ -0,0 +1,160 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//this is intended to be attached to a canvasd
public class dCoolDown : MonoBehaviour
{
//used to check if the playr has abillities
public PlayerStats stats;
public GameObject uiPrebab;
//special items
public SpecialItem dashItem;
public SpecialItem nitroItem;
//regular items with buttons
public Item kickItem;
public Item grapple;
public Item Glide;
public GameObject boxHighlight;
// Start is called before the first frame update
void Start(){
populatePlayerCanvas();
}
public void startUICooldown(string name)
{
this.gameObject.transform.Find(name).GetComponent<UICoolDown>().startCoolDown();
}
// Update is called once per frame
void Update()
{
////if tap is pressed, set active reversed
//not currently bounded to controller
if (Input.GetKeyDown(KeyCode.Tab))
{
if (boxHighlight.activeInHierarchy == false)
{
boxHighlight.SetActive(true);
}
else
{
boxHighlight.SetActive(false);
}
}
}
public void populatePlayerCanvas()
{
//apply special items (can condense and simplify if needed)
if (stats.HasNitro == true)
{
GameObject temp = Instantiate(uiPrebab);
temp.transform.SetParent(this.gameObject.transform);
temp.name = nitroItem.name;
temp.transform.localRotation = Quaternion.identity;
temp.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp.transform.localRotation.Set(0f, 0f, 0f, 0f);
temp.GetComponent<UICoolDown>().setCoolDownTime(nitroItem.cooldownM);
//set position on canvas
//due to low number, gonna hardcode this to be first
temp.transform.localPosition = new Vector3(-850, 425);
//set icon to ui icon
temp.transform.GetComponent<Image>().sprite = nitroItem.itemSprite;
//set button control (hard coded)
temp.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Shift";
}
if (stats.HasDash == true)
{
GameObject temp2 = Instantiate(uiPrebab);
temp2.transform.SetParent(this.gameObject.transform);
temp2.name = dashItem.name;
temp2.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp2.transform.localRotation = Quaternion.identity;
temp2.GetComponent<UICoolDown>().setCoolDownTime(dashItem.cooldownM);
//set image
temp2.transform.GetComponent<Image>().sprite = dashItem.itemSprite;
//if has nitro, make it below nitro icon
if (stats.HasNitro == true)
{
temp2.transform.localPosition = new Vector3(-850, 225);
}
//if not, make this icon top of screen
else
{
temp2.transform.localPosition = new Vector3(-850, 425);
}
//set button control
temp2.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "R";
}
////display guranteed items
// temp pos var
float posTemp = 0f;
//kick
GameObject temp3 = Instantiate(uiPrebab);
//set parent as highlight
temp3.transform.SetParent(boxHighlight.transform);
temp3.name = kickItem.name;
temp3.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp3.transform.localRotation = Quaternion.identity;
//due to low number, gonna hardcode this to be first
temp3.transform.localPosition = new Vector3(-100, -100);
//set icon to ui icon
temp3.transform.GetComponent<Image>().sprite = kickItem.itemSprite;
temp3.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "F";
//slide
GameObject temp4 = Instantiate(uiPrebab);
//set parent as highlight
temp4.transform.SetParent(boxHighlight.transform);
temp4.name = "slide";
temp4.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp4.transform.localRotation = Quaternion.identity;
//due to low number, gonna hardcode this to be first
temp4.transform.localPosition = new Vector3(100, -100);
//set icon to ui icon
//doesn't exists
temp4.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Slide \n Q";
////check if items are there
//grapple
if (stats.HasGrapple == true)
{
GameObject temp5 = Instantiate(uiPrebab);
//set parent as highlight
temp5.transform.SetParent(boxHighlight.transform);
temp5.name = grapple.itemName;
temp5.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp5.transform.localRotation = Quaternion.identity;
//due to low number, gonna hardcode this to be first
temp5.transform.localPosition = new Vector3(100 + posTemp, 100);
//set icon to ui icon
temp5.transform.GetComponent<Image>().sprite = grapple.itemSprite;
//doesn't exists
temp5.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "E";
//increment counter
posTemp -= 200;
}
//glider
if (stats.HasGlider == true)
{
GameObject temp6 = Instantiate(uiPrebab);
//set parent as highlight
temp6.transform.SetParent(boxHighlight.transform);
temp6.name = Glide.itemName;
temp6.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp6.transform.localRotation = Quaternion.identity;
//due to low number, gonna hardcode this to be first
temp6.transform.localPosition = new Vector3(100 + posTemp, 100);
//set icon to ui icon
temp6.transform.GetComponent<Image>().sprite = Glide.itemSprite;
//doesn't exists
temp6.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Hold Space";
//increment counter
posTemp -= 200;
}
}
}

View File

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

View File

@ -6,35 +6,35 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedScenePath-0:
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
value: 22424703114646680e0b0227036c7b151b180b650721283704240d14f0e12d3aedff78fce9332b25
flags: 0
RecentlyUsedScenePath-1:
value: 22424703114646680e0b0227036c7b151b180b650721283704240d14f0e12d3aedff78fce9332b25
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-2:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-3:
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c7b151b180b650e3a233126281f3fe7c23837e1ec25a7f234362820
flags: 0
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c731f1415016439262f2434
flags: 0
RecentlyUsedScenePath-7:
RecentlyUsedScenePath-4:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-8:
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
RecentlyUsedScenePath-9:
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c7b151b180b650e3a233126281f3fe7c23837e1ec25a7f234362820
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0