added font, updated ui, fixed some code
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Assets.Scripts.Classes;
|
||||
using Assets.Scripts.Player;
|
||||
using Assets.Scripts.Races;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -15,7 +16,6 @@ namespace Assets.Scripts
|
||||
public GameObject information;
|
||||
public GameObject fight;
|
||||
public GameObject message;
|
||||
public GameObject charactersheet;
|
||||
public GameObject deathscreen;
|
||||
public GameObject options;
|
||||
public GameObject pauseMenu;
|
||||
@@ -33,6 +33,7 @@ namespace Assets.Scripts
|
||||
void Start()
|
||||
{
|
||||
FileHandler.loadOptions(true);
|
||||
GameObject.Find("Player").GetComponent<PlayerGameObject>().getPlayerStat("Killcount").changeAmount(1);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -75,7 +76,7 @@ namespace Assets.Scripts
|
||||
|
||||
private void updatePlayerHUD()
|
||||
{
|
||||
updateHUD(GameObject.Find("Player").GetComponent<Player>());
|
||||
updateHUD(GameObject.Find("Player").GetComponent<PlayerGameObject>());
|
||||
}
|
||||
|
||||
public bool canPlayerMove()
|
||||
@@ -110,18 +111,6 @@ namespace Assets.Scripts
|
||||
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnCloseTutorial"));
|
||||
}
|
||||
|
||||
public void switchCharactersheet()
|
||||
{
|
||||
if (state == UIState.CHARACTER)
|
||||
{
|
||||
closeCharactersheet();
|
||||
}
|
||||
else
|
||||
{
|
||||
openCharactersheet();
|
||||
}
|
||||
}
|
||||
|
||||
public void openOptions()
|
||||
{
|
||||
FileHandler.loadOptionDisplay();
|
||||
@@ -137,22 +126,6 @@ namespace Assets.Scripts
|
||||
openPauseMenu();
|
||||
}
|
||||
|
||||
public void openCharactersheet()
|
||||
{
|
||||
hideOtherElements(charactersheet);
|
||||
state = UIState.CHARACTER;
|
||||
if(GameObject.Find("btnStrengthIncrease").transform.localScale != new Vector3(0,0,0)){
|
||||
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnStrengthIncrease"));
|
||||
}
|
||||
}
|
||||
|
||||
public void closeCharactersheet()
|
||||
{
|
||||
charactersheet.transform.localScale = new Vector3(0, 0, 0);
|
||||
showHUD();
|
||||
state = UIState.GAME;
|
||||
}
|
||||
|
||||
public void switchInventory()
|
||||
{
|
||||
if (state == UIState.INVENTORY)
|
||||
@@ -373,38 +346,36 @@ namespace Assets.Scripts
|
||||
|
||||
public void updateFightInterface(GameObject enemy, GameObject player)
|
||||
{
|
||||
updateFightInterfacePlayer(player);
|
||||
updateFightInterfacePlayer(player.GetComponent<PlayerGameObject>());
|
||||
updateFightInterfaceEnemy(enemy);
|
||||
updateFightInterfaceActions(player);
|
||||
updateFightInterfaceActions(player.GetComponent<PlayerGameObject>());
|
||||
GameObject.Find("txtRounds").GetComponent<Text>().text = (int.Parse(GameObject.Find("txtRounds").GetComponent<Text>().text) + 1).ToString();
|
||||
}
|
||||
|
||||
private void updateFightInterfaceActions(GameObject player)
|
||||
private void updateFightInterfaceActions(PlayerGameObject player)
|
||||
{
|
||||
GameObject actionFour = GameObject.Find("btnActionFour");
|
||||
GameObject actionFive = GameObject.Find("btnActionFive");
|
||||
GameObject actionSix = GameObject.Find("btnActionSix");
|
||||
|
||||
player.GetComponent<Player>().displayAction(0, actionFour.transform.Find("imgAction").gameObject, actionFour.transform.Find("descAction").gameObject);
|
||||
player.GetComponent<Player>().displayAction(1, actionFive.transform.Find("imgAction").gameObject, actionFive.transform.Find("descAction").gameObject);
|
||||
player.GetComponent<Player>().displayAction(2, actionSix.transform.Find("imgAction").gameObject, actionSix.transform.Find("descAction").gameObject);
|
||||
player.displayAction(0, actionFour.transform.Find("imgAction").gameObject, actionFour.transform.Find("descAction").gameObject);
|
||||
player.displayAction(1, actionFive.transform.Find("imgAction").gameObject, actionFive.transform.Find("descAction").gameObject);
|
||||
player.displayAction(2, actionSix.transform.Find("imgAction").gameObject, actionSix.transform.Find("descAction").gameObject);
|
||||
}
|
||||
|
||||
private void updateFightInterfacePlayer(GameObject player)
|
||||
private void updateFightInterfacePlayer(PlayerGameObject player)
|
||||
{
|
||||
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence };
|
||||
int[] playerStats = player.GetComponent<Player>().getStats();
|
||||
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, playerStats[1] + equipment["HP"], playerStats[0]);
|
||||
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, playerStats[3] + equipment["MP"], playerStats[2]);
|
||||
updateBar(foreground, background, text, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
|
||||
}
|
||||
|
||||
private void updateFightInterfaceEnemy(GameObject enemy)
|
||||
@@ -423,24 +394,22 @@ namespace Assets.Scripts
|
||||
updateBar(foreground, background, text, enemyStats[3], enemyStats[2]);
|
||||
}
|
||||
|
||||
public void adjustInformation(Player player)
|
||||
public void adjustInformation(PlayerGameObject player)
|
||||
{
|
||||
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience, points};
|
||||
int[] playerStats = player.GetComponent<Player>().getStats();
|
||||
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
|
||||
|
||||
GameObject.Find("txtStrength").GetComponent<Text>().text = "STR: " + playerStats[4] + " (+" + equipment["STR"] + ")";
|
||||
GameObject.Find("txtDexterity").GetComponent<Text>().text = "DEX: " + playerStats[5] + " (+" + equipment["DEX"] + ")";
|
||||
GameObject.Find("txtIntelligence").GetComponent<Text>().text = "INT: " + playerStats[6] + " (+" + equipment["INT"] + ")";
|
||||
GameObject.Find("txtHealth").GetComponent<Text>().text = TextHandler.getText("health") + " " + playerStats[1] + " (+" + equipment["HP"] + ")";
|
||||
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + playerStats[3] + " (+" + equipment["MP"] + ")";
|
||||
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"] + ")";
|
||||
|
||||
updateHealthUI(playerStats[0], playerStats[1] + equipment["HP"]);
|
||||
updateSecondaryUI(playerStats[2], playerStats[3] + equipment["MP"]);
|
||||
updateExperienceUI(playerStats[8], playerStats[9]);
|
||||
updateHealthUI(player.getPlayerStat("Health").getAmount(), player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"]);
|
||||
updateSecondaryUI(player.getPlayerStat("Secondary").getAmount(), player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"]);
|
||||
updateExperienceUI(player.getPlayerStat("Experience").getAmount(), player.getPlayerStat("MaxExperience").getAmount());
|
||||
|
||||
player.updateName(GameObject.Find("txtName").GetComponent<Text>());
|
||||
updatePoints(playerStats[10]);
|
||||
updatePoints(player.getPlayerStat("Points").getAmount());
|
||||
player.displaySkills(GameObject.Find("pnlSkills"));
|
||||
}
|
||||
|
||||
@@ -496,20 +465,18 @@ namespace Assets.Scripts
|
||||
updateFill(fill, null, maxExperience, experience);
|
||||
}
|
||||
|
||||
public void updateHUD(Player player)
|
||||
public void updateHUD(PlayerGameObject player)
|
||||
{
|
||||
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience};
|
||||
int[] playerStats = player.GetComponent<Player>().getStats();
|
||||
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
|
||||
|
||||
GameObject information = GameObject.Find("txtInformationHUD");
|
||||
player.updateNameHUD(information.GetComponent<Text>());
|
||||
|
||||
GameObject fill = GameObject.Find("HUD_healthFill");
|
||||
updateFill(fill, null, playerStats[1] + equipment["HP"], playerStats[0]);
|
||||
updateFill(fill, null, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
|
||||
|
||||
fill = GameObject.Find("HUD_secondaryFill");
|
||||
updateFill(fill, null, playerStats[3] + equipment["MP"], playerStats[2]);
|
||||
updateFill(fill, null, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
|
||||
}
|
||||
|
||||
public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)
|
||||
@@ -552,15 +519,14 @@ namespace Assets.Scripts
|
||||
if (PlayerPrefs.GetInt("isLoad") == 0)
|
||||
{
|
||||
GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().resetGame(PlayerPrefs.GetInt("cityAmount"));
|
||||
GameObject.Find("Player").GetComponent<Player>().generatePlayer();
|
||||
GameObject.Find("Player").GetComponent<Player>().finishPlayerCreation();
|
||||
GameObject.Find("Player").GetComponent<PlayerGameObject>().generatePlayer();
|
||||
hideOtherElements(introduction);
|
||||
state = UIState.INTRODUCTION;
|
||||
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnClose"));
|
||||
}
|
||||
else
|
||||
{
|
||||
FileHandler.loadGame(GameObject.Find("Player").GetComponent<Player>(), GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>(), GameObject.Find("Inventory").GetComponent<Inventory>(), GameObject.Find("QuestLog").GetComponent<QuestLog>());
|
||||
FileHandler.loadGame(GameObject.Find("Player").GetComponent<PlayerGameObject>(), GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>(), GameObject.Find("Inventory").GetComponent<Inventory>(), GameObject.Find("QuestLog").GetComponent<QuestLog>());
|
||||
hideOtherElements(introduction);
|
||||
introduction.transform.localScale = new Vector3(0, 0, 0);
|
||||
tutorial.transform.localScale = new Vector3(0,0,0);
|
||||
|
||||
Reference in New Issue
Block a user