Skip to content
Snippets Groups Projects
Commit cb38504f authored by Michael LaFreniere's avatar Michael LaFreniere
Browse files

More Portrait Work

Click to trigger on/off
parent 30ec88fb
No related branches found
No related tags found
No related merge requests found
Showing
with 24 additions and 10 deletions
No preview for this file type
No preview for this file type
......@@ -4,30 +4,44 @@ using UnityEngine.UI;
// ** Can potentially merge with the money script.
// will change the top left player portrait based on the player appearance!
// script to change the top left player portrait based on the player appearance and toggle the inventory panel.
public class Portrait : MonoBehaviour {
private setAppearance appearance;
private PlayerStats stats;
private PlayerStats stats; // to access name
public Text playerName;
public Image face;
public Image head;
public Color color;
private Color color;
private CanvasGroup inventory; // to toggle the panel on and off
// Use this for initialization
void Start () {
stats = GameObject.Find("Player").GetComponent<PlayerStats>();
appearance = GameObject.Find("Player").GetComponent<setAppearance>();
inventory = GameObject.Find("inventoryPanel").GetComponent<CanvasGroup>();
color = appearance.getColor();
playerName.text = stats.getName();
face.sprite = appearance.getFace();
head.sprite = appearance.getHead();
face.color = color;
head.color = color;
// inventory initially invisible
inventory.alpha = 0;
inventory.interactable = false;
inventory.blocksRaycasts = false;
}
// Update is called once per frame
void Update () {
}
public void OnClick() {
if (inventory.alpha == 1) { // if the inventory screen is up
inventory.alpha = 0; // hide
inventory.interactable = false;
inventory.blocksRaycasts = false;
}
else if (inventory.alpha == 0) { // if the inventory screen is hidden
inventory.alpha = 1; // show
inventory.interactable = true;
inventory.blocksRaycasts = true;
}
}
}
......@@ -16,7 +16,7 @@ public class ShopPages : MonoBehaviour {
axePanel.interactable = true;
swordPanel.alpha = 0;
swordPanel.interactable = false;
buttonText.text = "More Shields";
buttonText.text = "Next";
swordPanel.blocksRaycasts = false; // issues with pages if this isn't altered for some reason..
}
......@@ -32,7 +32,7 @@ public class ShopPages : MonoBehaviour {
swordPanel.interactable = true;
axePanel.alpha = 0;
axePanel.interactable = false;
buttonText.text = "Shields";
buttonText.text = "Next";
swordPanel.blocksRaycasts = true;
}
......@@ -41,7 +41,7 @@ public class ShopPages : MonoBehaviour {
axePanel.interactable = true;
swordPanel.alpha = 0;
swordPanel.interactable = false;
buttonText.text = "More Shields";
buttonText.text = "Back";
swordPanel.blocksRaycasts = false;
}
}
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment