fixed chest, improved ui, improved difficulty

This commit is contained in:
TAASONI3
2023-12-23 21:19:05 +01:00
parent 989732ff97
commit bf705a52a8
39 changed files with 6351 additions and 5676 deletions

View File

@@ -38,7 +38,7 @@ namespace Assets.Scripts
// Update is called once per frame
void Update()
{
if (state == UIState.GAME)
if (state == UIState.GAME || state == UIState.FIGHT)
{
if (GameObject.Find("Player").GetComponent<PlayerGameObject>().getPlayerStat("Killcount").getAmount() == -1)
{
@@ -161,6 +161,7 @@ namespace Assets.Scripts
{
GameObject.Find("txtRounds").GetComponent<Text>().text = "-1";
hideOtherElements(fight);
playerHUD.transform.localScale = new Vector3(1, 1, 1);
state = UIState.FIGHT;
}
@@ -352,7 +353,6 @@ namespace Assets.Scripts
public void updateFightInterface(GameObject enemy, GameObject player)
{
updateFightInterfacePlayer(player.GetComponent<PlayerGameObject>());
updateFightInterfaceEnemy(enemy);
updateFightInterfaceActions(player.GetComponent<PlayerGameObject>());
GameObject.Find("txtRounds").GetComponent<Text>().text = (int.Parse(GameObject.Find("txtRounds").GetComponent<Text>().text) + 1).ToString();
@@ -369,21 +369,6 @@ namespace Assets.Scripts
player.displayAction(2, actionSix.transform.Find("imgAction").gameObject, actionSix.transform.Find("descAction").gameObject);
}
private void updateFightInterfacePlayer(PlayerGameObject player)
{
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
GameObject foreground = GameObject.Find("healthForegroundPlayer");
GameObject background = GameObject.Find("healthBackgroundPlayer");
GameObject text = GameObject.Find("healthTextPlayer");
updateBar(foreground, background, text, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
foreground = GameObject.Find("secondaryForegroundPlayer");
background = GameObject.Find("secondaryBackgroundPlayer");
text = GameObject.Find("secondaryTextPlayer");
updateBar(foreground, background, text, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
}
private void updateFightInterfaceEnemy(GameObject enemy)
{
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence };
@@ -407,8 +392,8 @@ namespace Assets.Scripts
GameObject.Find("txtStrength").GetComponent<Text>().text = "STR: " + player.getPlayerStat("Strength").getAmount() + " (+" + equipment["STR"] + ")";
GameObject.Find("txtDexterity").GetComponent<Text>().text = "DEX: " + player.getPlayerStat("Dexterity").getAmount() + " (+" + equipment["DEX"] + ")";
GameObject.Find("txtIntelligence").GetComponent<Text>().text = "INT: " + player.getPlayerStat("Intelligence").getAmount() + " (+" + equipment["INT"] + ")";
GameObject.Find("txtHealth").GetComponent<Text>().text = TextHandler.getText("health") + " " + player.getPlayerStat("Health").getAmount() + " (+" + equipment["HP"] + ")";
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + player.getPlayerStat("Secondary").getAmount() + " (+" + equipment["MP"] + ")";
GameObject.Find("txtHealth").GetComponent<Text>().text = TextHandler.getText("health") + " " + player.getPlayerStat("MaxHealth").getAmount() + " (+" + equipment["HP"] + ")";
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + player.getPlayerStat("MaxSecondary").getAmount() + " (+" + equipment["MP"] + ")";
player.updateName(GameObject.Find("txtName").GetComponent<Text>());
updatePoints(player.getPlayerStat("Points").getAmount());
@@ -447,14 +432,18 @@ namespace Assets.Scripts
{
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
GameObject information = GameObject.Find("txtInformationHUD");
GameObject information = GameObject.Find("txtPlayerInformationHUD");
player.updateNameHUD(information.GetComponent<Text>());
GameObject fill = GameObject.Find("HUD_healthFill");
updateFill(fill, null, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
GameObject foreground = GameObject.Find("healthForegroundPlayer");
GameObject background = GameObject.Find("healthBackgroundPlayer");
GameObject text = GameObject.Find("healthTextPlayer");
updateBar(foreground, background, text, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
fill = GameObject.Find("HUD_secondaryFill");
updateFill(fill, null, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
foreground = GameObject.Find("secondaryForegroundPlayer");
background = GameObject.Find("secondaryBackgroundPlayer");
text = GameObject.Find("secondaryTextPlayer");
updateBar(foreground, background, text, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
}
public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)
@@ -475,22 +464,6 @@ namespace Assets.Scripts
bar.GetComponent<RectTransform>().offsetMax = new Vector2(-change, bar.GetComponent<RectTransform>().offsetMax.y);
}
public void updateFill(GameObject fill, GameObject textField, int maxValue, int minValue)
{
string text = minValue + "/" + maxValue;
float percentage = 0;
if (maxValue > 0)
{
percentage = (1 / (float)maxValue) * minValue;
}
if (textField != null)
{
textField.GetComponent<Text>().text = text;
}
fill.GetComponent<Image>().fillAmount = percentage;
}
public void openIntroduction()
{
GameObject.Find("AudioHandler").GetComponent<AudioHandler>().Start();