Added skills to char window, added house information

This commit is contained in:
Nicola Sovic
2022-02-24 13:25:35 +01:00
parent e5e2ad6768
commit 61b81da607
19 changed files with 1254 additions and 20 deletions

View File

@@ -16,6 +16,7 @@ namespace Assets.Scripts
int cooldown;
int maxCooldown;
string skillname;
string description;
Texture skillIcon;
GameObject skillAnimation;
@@ -31,6 +32,11 @@ namespace Assets.Scripts
this.skillAnimation = skillAnimation;
}
public void setDescription(string desc)
{
description = desc;
}
public int calculateDamage(int attribute, bool isCrit)
{
cooldown = maxCooldown;
@@ -64,6 +70,12 @@ namespace Assets.Scripts
}
}
public void displaySkill(GameObject image, GameObject desc)
{
image.GetComponent<RawImage>().texture = skillIcon;
desc.GetComponent<Text>().text = skillname + "(Lvl." + level + "): \r\n" + description;
}
public void reduceCooldown()
{
if (cooldown > 0)

View File

@@ -74,18 +74,27 @@ namespace Assets.Scripts
{
case "Warrior":
skills[0] = new BasicSkill(15,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].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].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].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].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].setDescription("What a big fireball. Does some good damage");
break;
}
}
@@ -226,7 +235,7 @@ namespace Assets.Scripts
return result;
}
public void displaySkill(int index, GameObject image, GameObject desc)
public void displayAction(int index, GameObject image, GameObject desc)
{
skills[index].display(image, desc, secondary);
}
@@ -437,5 +446,14 @@ namespace Assets.Scripts
uihandler.showMessage("ERROR;You don't have enough points!");
}
}
public void displaySkills(GameObject pnlSkills)
{
for (int i = 1; i <= 3; i++)
{
GameObject skill = pnlSkills.transform.Find("skill" + i).gameObject;
skills[i-1].displaySkill(skill.transform.Find("imgAction").gameObject, skill.transform.Find("descAction").gameObject);
}
}
}
}

View File

@@ -63,6 +63,9 @@ namespace Assets.Scripts
case "city":
displayInformation("City");
break;
case "house":
displayInformation("House");
break;
}
}
}

View File

@@ -404,9 +404,9 @@ namespace Assets.Scripts
GameObject actionFive = GameObject.Find("action5");
GameObject actionSix = GameObject.Find("action6");
player.GetComponent<Player>().displaySkill(0, actionFour.transform.Find("imgAction").gameObject, actionFour.transform.Find("descAction").gameObject);
player.GetComponent<Player>().displaySkill(1, actionFive.transform.Find("imgAction").gameObject, actionFive.transform.Find("descAction").gameObject);
player.GetComponent<Player>().displaySkill(2, actionSix.transform.Find("imgAction").gameObject, actionSix.transform.Find("descAction").gameObject);
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);
}
private void updateFightInterfacePlayer(GameObject player)
@@ -458,6 +458,7 @@ namespace Assets.Scripts
player.updateName(GameObject.Find("txtName").GetComponent<Text>());
updatePoints(playerStats[10]);
player.displaySkills(GameObject.Find("pnlSkills"));
}
private void updatePoints(int points)