UI and mechanics update, v1.1.0

This commit is contained in:
Nicola Sovic
2022-03-10 18:34:15 +01:00
parent 9c92d59b17
commit 8f15cbdeb7
7 changed files with 130 additions and 26 deletions

View File

@@ -62,18 +62,18 @@ namespace Assets.Scripts
image.GetComponent<RawImage>().texture = skillIcon;
if (canPlayerCast(playerSecondary))
{
desc.GetComponent<Text>().text = skillname + "(Lvl." + level + ") (" + secondaryConsumption + ")";
desc.GetComponent<Text>().text = skillname + "(" + secondaryConsumption + ")";
}
else
{
desc.GetComponent<Text>().text = "Not castable (" + secondaryConsumption + ")";
desc.GetComponent<Text>().text = "(" + secondaryConsumption + " mana) " + "("+cooldown+" cd)";
}
}
public void displaySkill(GameObject image, GameObject desc)
{
image.GetComponent<RawImage>().texture = skillIcon;
desc.GetComponent<Text>().text = skillname + "(Lvl." + level + "): \r\n" + description;
desc.GetComponent<Text>().text = skillname + "(Mana: " + secondaryConsumption + "): \r\n" + description;
}
public void reduceCooldown()

View File

@@ -111,6 +111,7 @@ namespace Assets.Scripts
audioHandler.playButtonClick();
uihandler.adaptScreen();
audioHandler.saveAudioSettings();
uihandler.closeOptions();
}
public void closeTutorial()

View File

@@ -35,6 +35,7 @@ namespace Assets.Scripts
BasicSkill[] skills = new BasicSkill[3];
int points = 0;
bool isDodging = false;
DateTime jumpTimer;
int killcount = -1;
int difficulty = 0;
@@ -73,27 +74,27 @@ namespace Assets.Scripts
switch (role.classname)
{
case "Warrior":
skills[0] = new BasicSkill(15,10,2,"Slash","Skills/Warrior/Slash",null);
skills[0] = new BasicSkill(20,10,2,"Slash","Skills/Warrior/Slash",null);
skills[0].setDescription("A basic slash. But better than a basic attack");
skills[1] = new BasicSkill(0, 5, 1, "Block", "Skills/Warrior/Block", null);
skills[1].setDescription("Block the next attack");
skills[2] = new BasicSkill(30, 30, 4, "Execution", "Skills/Warrior/Execution", null);
skills[2] = new BasicSkill(35, 30, 4, "Execution", "Skills/Warrior/Execution", null);
skills[2].setDescription("A powerful skill. But hard to cast early");
break;
case "Thief":
skills[0] = new BasicSkill(15, 10, 2, "Stab", "Skills/Thief/Stab", null);
skills[0] = new BasicSkill(20, 10, 2, "Stab", "Skills/Thief/Stab", null);
skills[0].setDescription("Early skill to apply some damage.");
skills[1] = new BasicSkill(0, 5, 1, "SmokeScreen", "Skills/Thief/SmokeScreen", null);
skills[1].setDescription("Hide from the next attack");
skills[2] = new BasicSkill(30, 30, 4, "Heartstop", "Skills/Thief/Heartstop", null);
skills[2] = new BasicSkill(35, 30, 4, "Heartstop", "Skills/Thief/Heartstop", null);
skills[2].setDescription("Stop the heart of your enemy. High damage.");
break;
case "Mage":
skills[0] = new BasicSkill(15, 10, 2, "Icicle", "Skills/Mage/Icicle", null);
skills[0] = new BasicSkill(20, 10, 2, "Icicle", "Skills/Mage/Icicle", null);
skills[0].setDescription("Small icicles to cut down your enemies HP");
skills[1] = new BasicSkill(0, 5, 1, "Teleport", "Skills/Mage/Teleport", null);
skills[1].setDescription("Evade the next attack");
skills[2] = new BasicSkill(30, 30, 4, "Fireball", "Skills/Mage/Fireball", null);
skills[2] = new BasicSkill(35, 30, 4, "Fireball", "Skills/Mage/Fireball", null);
skills[2].setDescription("What a big fireball. Does some good damage");
break;
}
@@ -156,7 +157,7 @@ namespace Assets.Scripts
private void healPlayer()
{
health = health + 5;
health = health + 30 / (difficulty + 1);
if (health >= maxHealth)
{
health = maxHealth;
@@ -170,8 +171,18 @@ namespace Assets.Scripts
if (Input.GetKeyDown(KeyCode.Space))
{
if ((int)(gameObject.GetComponent<Rigidbody>().velocity.y * 10) == 0)
if (jumpTimer != null)
{
if (jumpTimer.AddSeconds(1).CompareTo(DateTime.Now) <= 0)
{
jumpTimer = DateTime.Now;
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(0, 5, 0);
audioHandler.playJump();
}
}
else
{
jumpTimer = DateTime.Now;
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(0, 5, 0);
audioHandler.playJump();
}
@@ -350,7 +361,7 @@ namespace Assets.Scripts
{
uihandler.showMessage("SUCCESS;You killed your enemy!");
killcount++;
if (killcount == 30 * (difficulty + 1) && GameObject.Find("Worldgenerator").GetComponent<WorldGenerator>().gameWon())
if (killcount >= 30 * (difficulty + 1) && GameObject.Find("Worldgenerator").GetComponent<WorldGenerator>().gameWon())
{
uihandler.showMessage("SUCCESS;You won the game!");
}

View File

@@ -29,7 +29,7 @@ namespace Assets.Scripts.Slimes
strength = playerStats[4];
dexterity = playerStats[5];
intelligence = playerStats[6];
experience = (int)(10 + playerStats[7] * 1.5f);
experience = (int)(10 + playerStats[7] * 2.5f);
level = playerStats[7];
}

View File

@@ -192,7 +192,6 @@ namespace Assets.Scripts
state = UIState.PAUSEOPTIONS;
}
GameObject.Find("ScrollbarOptions").GetComponent<Scrollbar>().value = 1f;
}
public void closeOptions()
@@ -273,7 +272,16 @@ namespace Assets.Scripts
}
else
{
openPauseMenu();
if (state == UIState.GAME)
{
openPauseMenu();
}
else
{
hideOtherElements(null);
showHUD();
state = UIState.GAME;
}
}
}
}
@@ -374,7 +382,10 @@ namespace Assets.Scripts
GameObject.Find("Canvas").transform.GetChild(i).localScale = new Vector3(0, 0, 0);
}
}
obj.transform.localScale = new Vector3(1, 1, 1);
if (obj != null)
{
obj.transform.localScale = new Vector3(1, 1, 1);
}
}
public void displayInformation(string information)
@@ -453,7 +464,7 @@ namespace Assets.Scripts
GameObject.Find("txtDexterity").GetComponent<Text>().text = "DEX: " + playerStats[5];
GameObject.Find("txtIntelligence").GetComponent<Text>().text = "INT: " + playerStats[6];
GameObject.Find("txtHealth").GetComponent<Text>().text = "Health: " + playerStats[1];
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Secondary: " + playerStats[3];
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + playerStats[3];
updateHealthUI(playerStats[0], playerStats[1]);
updateSecondaryUI(playerStats[2], playerStats[3]);
@@ -540,7 +551,12 @@ namespace Assets.Scripts
public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)
{
string text = minValue + "/" + maxValue;
double percentage = (1 / (double)maxValue) * minValue;
double percentage = 0;
if (maxValue > 0)
{
percentage = (1 / (double)maxValue) * minValue;
}
float change = (float)(barBackground.GetComponent<RectTransform>().rect.width - (barBackground.GetComponent<RectTransform>().rect.width * percentage));
if (textField != null)