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

Portrait Coming Along

- displays stat numbers and potions in inventory
- blessings turn green when active
- can buy stats to allocate
(left to do, buttons to allocate stats, health bar)
parent ef4f5111
No related branches found
No related tags found
No related merge requests found
Showing
with 126 additions and 23 deletions
No preview for this file type
......@@ -62,6 +62,7 @@
<Compile Include="Assets\Scripts\Portrait.cs" />
<Compile Include="Assets\Scripts\Prefight.cs" />
<Compile Include="Assets\Scripts\RandomPlatforms.cs" />
<Compile Include="Assets\Scripts\buyStat.cs" />
<Compile Include="Assets\Scripts\characterCreation\ChooseCharLook.cs" />
<Compile Include="Assets\Scripts\characterCreation\ChooseCharStats.cs" />
<Compile Include="Assets\Scripts\enemyAppearance\RandomFace.cs" />
......
No preview for this file type
......@@ -12,21 +12,21 @@ public class PlayerStats : MonoBehaviour {
private static float maxHealth;
public static float curHealth;
public static string playerName;
private static int vitality;
private static int strength;
private static int defense;
private static int agility;
private static int luck;
public static int vitality; // need all these as public for the player portrait
public static int strength;
public static int defense;
public static int agility;
public static int luck;
private static int money; // to be manipulated by shops
//below will act as the invetory
private static int healthPotions;
private static int strengthPotions;
private static int defensePotions;
private static int agilityPotions;
private static bool offenseBlessing;
private static bool defenseBlessing;
private static bool luckBlessing;
public static int healthPotions;
public static int strengthPotions;
public static int defensePotions;
public static int agilityPotions;
public static bool offenseBlessing;
public static bool defenseBlessing;
public static bool luckBlessing;
public WeaponStats defaultWeapon; // Incase currentWeapon not set properly. Set this in inspector!
public ArmourStats defaultShield;
......
......@@ -12,26 +12,76 @@ public class Portrait : MonoBehaviour {
public Text playerName;
public Image face;
public Image head;
private Color color;
private Color characterColor;
private CanvasGroup inventory; // to toggle the panel on and off
// Use this for initialization
// fields used to set the inventory panel information
// stats
public Text vitality;
public Text strength;
public Text defense;
public Text agility;
public Text luck;
public Text unallocated;
public static int unallocatedStats;
// poitions
public Text healthPotCount;
public Text strengthPotCount;
public Text defensePotCount;
public Text agilityPotCount;
// blessings
public Image offenseBlessing;
public Image defenseBlessing;
public Image luckBlessing;
void Start () {
stats = GameObject.Find("Player").GetComponent<PlayerStats>();
appearance = GameObject.Find("Player").GetComponent<setAppearance>();
inventory = GameObject.Find("inventoryPanel").GetComponent<CanvasGroup>();
color = appearance.getColor();
characterColor = appearance.getColor();
playerName.text = stats.getName();
face.sprite = appearance.getFace();
head.sprite = appearance.getHead();
face.color = color;
head.color = color;
head.color = characterColor;
offenseBlessing.color = Color.white;
defenseBlessing.color = Color.white;
luckBlessing.color = Color.white;
setInventory();
// inventory initially invisible
inventory.alpha = 0;
inventory.interactable = false;
inventory.blocksRaycasts = false;
}
public void setInventory() {
// get stats
vitality.text = PlayerStats.vitality.ToString();
strength.text = PlayerStats.strength.ToString();
defense.text = PlayerStats.defense.ToString();
agility.text = PlayerStats.agility.ToString();
luck.text = PlayerStats.luck.ToString();
unallocated.text = unallocatedStats.ToString();
// get potions
healthPotCount.text = PlayerStats.healthPotions.ToString();
strengthPotCount.text = PlayerStats.strengthPotions.ToString();
defensePotCount.text = PlayerStats.defensePotions.ToString();
agilityPotCount.text = PlayerStats.agilityPotions.ToString();
// get blessings
if (PlayerStats.offenseBlessing == true) {
offenseBlessing.color = Color.green; // show the blessing as active
}
if (PlayerStats.defenseBlessing == true) {
defenseBlessing.color = Color.green; // show the blessing as active
}
if (PlayerStats.luckBlessing == true) {
luckBlessing.color = Color.green; // show the blessing as active
}
}
// when clicking the player's portrait
public void OnClick() {
if (inventory.alpha == 1) { // if the inventory screen is up
inventory.alpha = 0; // hide
......@@ -39,6 +89,7 @@ public class Portrait : MonoBehaviour {
inventory.blocksRaycasts = false;
}
else if (inventory.alpha == 0) { // if the inventory screen is hidden
setInventory();
inventory.alpha = 1; // show
inventory.interactable = true;
inventory.blocksRaycasts = true;
......
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class buyStat : MonoBehaviour {
public Money money; // to access and manipulate coin amount
public Text cost;
public Button statButton;
private int price;
private ColorBlock block;
private Portrait portrait;
void Start() {
portrait = GameObject.Find("portraitButton").GetComponent<Portrait>();
price = int.Parse(cost.text);
block = new ColorBlock();
block = statButton.colors;
}
// setting the pressed colors correctly
void Update() {
if (money.getMoney() >= price) {
block.pressedColor = Color.green;
statButton.colors = block;
}
else {
block.pressedColor = Color.red; // can't afford = red click
statButton.colors = block;
}
}
public void OnClick() {
if (money.getMoney() >= price) {
money.decreaseCoins(price);
Portrait.unallocatedStats = Portrait.unallocatedStats + 1;
cost.text = (price + 3).ToString();
price = int.Parse(cost.text);
portrait.setInventory();
}
}
}
fileFormatVersion: 2
guid: 5af404338739db742b16704ddcc6772e
timeCreated: 1480302943
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -32,7 +32,7 @@ public class ShopPages : MonoBehaviour {
swordPanel.interactable = true;
axePanel.alpha = 0;
axePanel.interactable = false;
buttonText.text = "Next";
buttonText.text = "Back";
swordPanel.blocksRaycasts = true;
}
......@@ -41,7 +41,7 @@ public class ShopPages : MonoBehaviour {
axePanel.interactable = true;
swordPanel.alpha = 0;
swordPanel.interactable = false;
buttonText.text = "Back";
buttonText.text = "Next";
swordPanel.blocksRaycasts = false;
}
}
......
No preview for this file type
No preview for this file type
sceneSetups:
<<<<<<< HEAD
- path: Assets/Scenes/arena.unity
=======
- path: Assets/Scenes/Town01.unity
>>>>>>> origin/master
isLoaded: 1
isActive: 1
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