Edited UI functions for functionallity in network

-Added popups to map
This commit is contained in:
Evan Nydahl
2022-03-11 15:10:48 -06:00
parent ae66378ca1
commit 38e01ac1e5
12 changed files with 1097 additions and 70 deletions

View File

@@ -1173,7 +1173,7 @@ MonoBehaviour:
animator: {fileID: 0}
pStats: {fileID: 0}
mSM: {fileID: 0}
driver: {fileID: 0}
driver: {fileID: 5149733669485025623}
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: 0}
driver: {fileID: 5149733669485025623}
nitroItem: {fileID: 11400000, guid: a1c26807795a7ac4f83567455ce978ce, type: 2}
nitroVelBoost: 40
nitroAccBoost: 0.4

View File

@@ -5075,7 +5075,7 @@ MonoBehaviour:
animator: {fileID: 0}
pStats: {fileID: 0}
mSM: {fileID: 0}
driver: {fileID: 0}
driver: {fileID: 8643913596794274241}
dashItem: {fileID: 11400000, guid: 3156de54e455b4348b2a6e79383383b0, type: 2}
--- !u!114 &7688428083034862390
MonoBehaviour:
@@ -5093,7 +5093,7 @@ MonoBehaviour:
moveController: {fileID: 0}
pStats: {fileID: 0}
mSM: {fileID: 0}
driver: {fileID: 0}
driver: {fileID: 8643913596794274241}
nitroItem: {fileID: 11400000, guid: a1c26807795a7ac4f83567455ce978ce, type: 2}
nitroVelBoost: 40
nitroAccBoost: 0.4

View File

@@ -162,7 +162,7 @@ Transform:
- {fileID: 8200857314457501958}
- {fileID: 4801201675622690668}
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &45642691
GameObject:
@@ -447,7 +447,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 197.763, z: 0}
--- !u!1 &310775963
GameObject:
@@ -542,7 +542,7 @@ Transform:
m_LocalScale: {x: 243.4848, y: 10, z: 100}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &689939137
PrefabInstance:
@@ -553,7 +553,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: -8679921383154817045, guid: d583fb6b27d23a849b80c1ea7d813943, type: 3}
propertyPath: m_RootOrder
value: 1
value: 2
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: d583fb6b27d23a849b80c1ea7d813943, type: 3}
propertyPath: m_LocalPosition.x
@@ -670,6 +670,10 @@ PrefabInstance:
propertyPath: hasGrapple
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1707207228499037468, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3}
propertyPath: hasWallrun
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5759777694531189237, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3}
propertyPath: m_RootOrder
value: 11
@@ -720,6 +724,71 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3}
--- !u!1001 &933633206
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -7350152320695563460, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: item
value:
objectReference: {fileID: 11400000, guid: 3c5f77adbd146274281d636352eb5018, type: 2}
- target: {fileID: -7350152320695563460, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: message
value: Heck You
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalPosition.x
value: 49.493553
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalPosition.y
value: 5.000001
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalPosition.z
value: -0.5475292
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 729017849394081224, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4887495073678318998, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
propertyPath: m_Name
value: PopUp
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b60c7d344c81e904cb07f52bb99b2afa, type: 3}
--- !u!1 &988955190
GameObject:
m_ObjectHideFlags: 0
@@ -753,7 +822,7 @@ Transform:
- {fileID: 1364344412}
- {fileID: 128722834}
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1099726822
GameObject:
@@ -849,7 +918,7 @@ Transform:
m_LocalScale: {x: 4, y: 4, z: 4}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1364344411
GameObject:
@@ -7948,7 +8017,7 @@ Transform:
- {fileID: 7166745667220549356}
- {fileID: 7674073525341041895}
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4717015385984152624
GameObject:
@@ -9223,7 +9292,7 @@ Transform:
- {fileID: 1238986339987449071}
- {fileID: 4381207511937094485}
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 353.008, z: 0}
--- !u!1 &5464757302679342334
GameObject:
@@ -11501,7 +11570,7 @@ Transform:
- {fileID: 1695416246655401831}
- {fileID: 6083860270965389840}
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &7215587182093335156
MeshRenderer:
@@ -11912,7 +11981,7 @@ Transform:
- {fileID: 5203016803932664549}
- {fileID: 3404700905833877519}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
--- !u!33 &7422091022867816153
MeshFilter:

File diff suppressed because it is too large Load Diff

View File

@@ -31,6 +31,7 @@ public class CoolDown : MonoBehaviour
temp.transform.SetParent(this.gameObject.transform);
temp.name = nitroItem.name;
temp.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp.transform.rotation.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
@@ -38,13 +39,14 @@ public class CoolDown : MonoBehaviour
//set icon to ui icon
temp.transform.GetComponent<Image>().sprite = nitroItem.itemSprite;
//set button control (hard coded)
temp.transform.Find("Button Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = "Shift";
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.rotation.Set(0f, 0f, 0f, 0f);
temp2.GetComponent<UICoolDown>().setCoolDownTime(dashItem.cooldownM);
//set image
@@ -60,7 +62,7 @@ public class CoolDown : MonoBehaviour
temp2.transform.localPosition = new Vector3(-850, 425);
}
//set button control
temp2.transform.Find("Button Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = "R";
temp2.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "R";
}
////display guranteed items
@@ -72,11 +74,12 @@ public class CoolDown : MonoBehaviour
temp3.transform.SetParent(boxHighlight.transform);
temp3.name = kickItem.name;
temp3.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp3.transform.rotation.Set(0f, 0f, 0f, 0f);
//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.Find("Button Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = "F";
temp3.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "F";
//slide
GameObject temp4 = Instantiate(uiPrebab);
@@ -84,11 +87,12 @@ public class CoolDown : MonoBehaviour
temp4.transform.SetParent(boxHighlight.transform);
temp4.name = "slide";
temp4.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp4.transform.rotation.Set(0f, 0f, 0f, 0f);
//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.Find("Button Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = "Slide \n Q";
temp4.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Slide \n Q";
////check if items are there
//grapple
@@ -98,12 +102,13 @@ public class CoolDown : MonoBehaviour
temp5.transform.SetParent(boxHighlight.transform);
temp5.name = grapple.itemName;
temp5.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp5.transform.rotation.Set(0f, 0f, 0f, 0f);
//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.Find("Button Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = "E";
temp5.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "E";
//increment counter
posTemp -= 200;
}
@@ -114,12 +119,13 @@ public class CoolDown : MonoBehaviour
temp6.transform.SetParent(boxHighlight.transform);
temp6.name = Glide.itemName;
temp6.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
temp6.transform.rotation.Set(0f, 0f, 0f, 0f);
//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.Find("Button Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = "Hold Space";
temp6.transform.GetComponentInChildren<TMPro.TextMeshProUGUI>().text = "Hold Space";
//increment counter
posTemp -= 200;
}
@@ -130,7 +136,6 @@ public class CoolDown : MonoBehaviour
}
public void startUICooldown(string name){
Debug.Log("its me");
this.gameObject.transform.Find(name).GetComponent<UICoolDown>().startCoolDown();
}
// Update is called once per frame

View File

@@ -39,7 +39,6 @@ public class dDashStateManager : NetworkBehaviour
moveController = GetComponent<CharacterController>(); // set Character Controller
animator = GetComponent<Animator>(); // set animator
animationManager = GetComponent<dAnimationManager>();
driver = GameObject.Find("PlayerCanvas").GetComponent<CoolDown>();
////
////Initialize Scripts

View File

@@ -36,11 +36,8 @@ public class dNitroCooldownState : dNitroBaseState
//cooldown timer
private IEnumerator startCoolDown(dNitroStateManager nSM){
Debug.Log("Hello");
nSM.driver.startUICooldown("Nitro");
Debug.Log("DE");
yield return new WaitForSeconds(nSM.nitroItem.cooldownM);
Debug.Log("Done");
cooldown = true;
}
}

View File

@@ -54,7 +54,7 @@ public class dNitroStateManager : NetworkBehaviour
parentObj = transform.parent.gameObject; // set parent object
animator = GetComponent<Animator>(); // set animator
animationManager = GetComponent<dAnimationManager>();
driver = GameObject.Find("PlayerCanvas").GetComponent<CoolDown>();
////
////Initialize Scripts

View File

@@ -38,7 +38,6 @@ public class DashStateManager : NetworkBehaviour
////Initialize Player Components
moveController = GetComponent<CharacterController>(); // set Character Controller
animator = GetComponent<Animator>(); // set animator
driver = GameObject.Find("PlayerCanvas").GetComponent<CoolDown>();
////
////Initialize Scripts

View File

@@ -53,7 +53,6 @@ public class NitroStateManager : NetworkBehaviour
parentObj = transform.parent.gameObject; // set parent object
animator = GetComponent<Animator>(); // set animator
animationManager = GetComponent<AnimationManager>();
driver = GameObject.Find("PlayerCanvas").GetComponent<CoolDown>();
////
////Initialize Scripts

View File

@@ -13,39 +13,31 @@ public class PopUpScript : MonoBehaviour
//for some reason on enter was triggering twice (shouldn't happen but couldn't figure out why
private bool isPop = false;
private GameObject temp;
private GameObject canvas;
private void Start()
{
canvas = GameObject.Find("Canvas");
}
private Canvas canvas;
private void OnTriggerEnter(Collider other)
{
//if it is the player object, no pop up is active, and they have the required item
if (other.gameObject.tag == "ArcherTarget" && isPop == false)
{
Debug.Log("enter");
//if the item is not set or values are null, catch it
try
{
//Debug.Log("enter");
temp = Instantiate(uiPrebab);
//set parent as highlight
temp.transform.SetParent(canvas.transform);
temp.name = item.name;
temp.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
//due to low number, gonna hardcode this to be first
temp.transform.localPosition = new Vector3(0, 0);
//set icon to ui icon
temp.transform.GetComponent<Image>().sprite = item.itemSprite;
//set text
temp.transform.Find("Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = message;
//no longer allow instnatiation
isPop = true;
Debug.Log("create");
}
catch (System.Exception e)
//for for cleaner code if this check is done in player or a function in this class
//if the item is not null (item given) check if player has the item and if they do send popup
if(item != null)
{
Debug.Log("error with item");
if ((other.transform.GetComponent<PlayerStats>().HasDash && item.name == "Dash") || (other.transform.GetComponent<PlayerStats>().HasGrapple && item.name == "Grapple") || (other.transform.GetComponent<PlayerStats>().HasWallrun && item.name == "Wall Run") || (other.transform.GetComponent<PlayerStats>().HasGlider && item.name == "Glider"))
{
setUpItemPopUp(other);
}
}
// if item is not set, it assumed that the popup is used for slidding (no item for slidding exists so this
// is necessary)
else if(item == null)
{
setUpSlidePopUp(other);
}
}
@@ -53,13 +45,75 @@ public class PopUpScript : MonoBehaviour
}
private void OnTriggerExit(Collider other)
{
//delete ui element when exit
if (other.gameObject.tag == "ArcherTarget")
//delete ui element when exit if it exist
if (other.gameObject.tag == "ArcherTarget" && temp != null)
{
Debug.Log("exit");
//Debug.Log("exit");
//remove reference to canvas
canvas = null;
//attempt to find
Destroy(temp);
isPop = false;
}
}
private void setUpItemPopUp(Collider other)
{
//if the item is not set or values are null, catch it
try
{
//try to get canvas from player
canvas = other.transform.root.GetComponentInChildren<Canvas>();
temp = Instantiate(uiPrebab);
//set parent as highlight
temp.transform.SetParent(canvas.transform);
temp.name = item.name + "PopUp";
temp.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
//due to low number, gonna hardcode this to be first
temp.transform.localPosition = new Vector3(0, 0);
//set icon to ui icon
temp.transform.GetComponent<Image>().sprite = item.itemSprite;
//set text
temp.transform.Find("Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = message;
//no longer allow instnatiation
isPop = true;
//Debug.Log("create");
}
catch (System.Exception e)
{
Debug.Log("error with item");
}
}
private void setUpSlidePopUp(Collider other)
{
//if the item is not set or values are null, catch it
try
{
//try to get canvas from player
canvas = other.transform.root.GetComponentInChildren<Canvas>();
temp = Instantiate(uiPrebab);
//set parent as highlight
temp.transform.SetParent(canvas.transform);
temp.name = "SlidePopUp";
temp.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
//due to low number, gonna hardcode this to be first
temp.transform.localPosition = new Vector3(0, 0);
//set text
temp.transform.Find("Prompt").GetComponent<TMPro.TextMeshProUGUI>().text = message;
//no longer allow instnatiation
isPop = true;
//Debug.Log("create");
}
catch (System.Exception e)
{
Debug.Log("error with item");
}
}
}

View File

@@ -21,19 +21,19 @@ EditorUserSettings:
value: 22424703114646680e0b0227036c7b151b180b650721283704240d14f0e12d3aedff78fce9332b25
flags: 0
RecentlyUsedScenePath-5:
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
flags: 0
RecentlyUsedScenePath-6:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
flags: 0
RecentlyUsedScenePath-7:
value: 22424703114646680e0b0227036c7b151b180b652b3a27292f260573f1e33136e7a923e7ee2e26
value: 22424703114646680e0b0227036c7b151b180b650e3a233126281f3fe7c23837e1ec25a7f234362820
flags: 0
RecentlyUsedScenePath-8:
value: 22424703114646680e0b0227036c78111b125507233d28242c20137df7ee3d2cfb
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
RecentlyUsedScenePath-9:
value: 22424703114646680e0b0227036c7b151b180b650e3a233126281f3fe7c23837e1ec25a7f234362820
value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650