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

@@ -11,61 +11,29 @@ namespace Assets.Scripts
{
class EasterEggHandler
{
public static void applyEasterEgg(PlayerObject player)
public static void applyEasterEgg(string playername)
{
if (player.getPlayerName().ToLower().Length > 0)
if (playername.ToLower().Length > 0)
{
applyNameEasterEgg(player);
applyNameEasterEgg(playername.ToLower());
}
}
private static void applyNameEasterEgg(PlayerObject player)
private static void applyNameEasterEgg(string playername)
{
//maxHealth, maxSecondary, strength, dexterity, intelligence
/*int[] result = new int[5];
int[] stats = player.getStats();
switch (player.getPlayerName().ToLower())
//TODO: Create achievements fitting of their contribution... no game changing things, except godmode
switch (playername)
{
case "threetimes8":
result[0] = 240;
result[1] = 240;
result[2] = 24;
result[3] = 24;
result[4] = 24;
break;
case "finnchen123":
result[0] = 1230;
result[1] = 1230;
result[2] = 123;
result[3] = 123;
result[4] = 123;
break;
case "thefluffeypanda":
result[0] = 470;
result[1] = 470;
result[2] = 47;
result[3] = 47;
result[4] = 47;
break;
case "nicola":
result[0] = stats[1];
result[1] = stats[3];
result[2] = stats[4];
result[3] = stats[5];
result[4] = stats[6];
SteamWorksHandler.getGodModeAchievement();
break;
default:
result[0] = stats[1];
result[1] = stats[3];
result[2] = stats[4];
result[3] = stats[5];
result[4] = stats[6];
break;
}
player.setStats(result);*/
//TODO FIX whole Easteregg mechanic to go with the new player
}
public static bool isGodMode(PlayerObject player)

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();