Skip to content
Snippets Groups Projects
Commit 75d9081a authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

`SetElements` now resets the list.

- Also fixes exception from list being null.
parent 0e364537
No related branches found
No related tags found
1 merge request!84Merge, ability cluster
......@@ -6,29 +6,30 @@ using BigSock.Service;
namespace BigSock.UI
{
public class AbilityCluster : MonoBehaviour
{
private const string ABILITYELEMENT = "UI/Ability";
private List<AbilityElement> abilityList;
public class AbilityCluster : MonoBehaviour
{
private const string ABILITYELEMENT = "UI/Ability";
private List<AbilityElement> abilityList;
public void SetElements(int elementAmount)
public void SetElements(int elementAmount)
{
for (int i = 0; i < elementAmount; ++i)
abilityList = new List<AbilityElement>();
for (int i = 0; i < elementAmount; ++i)
{
abilityList.Add(PrefabService.SINGLETON.Instance(ABILITYELEMENT, transform).GetComponent<AbilityElement>());
}
}
abilityList.Add(PrefabService.SINGLETON.Instance(ABILITYELEMENT, transform).GetComponent<AbilityElement>());
}
}
public void SetCooldown(int index, float amount)
{
abilityList[index].WithCooldown(amount);
}
public void SetCooldown(int index, float amount)
{
abilityList[index].WithCooldown(amount);
}
public void SetCharge(int index, float amount)
{
abilityList[index].WithCharge(amount);
}
public void SetCharge(int index, float amount)
{
abilityList[index].WithCharge(amount);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment