Files
3DBlobici-WorkingTitle/3D blobici/Assets/Scripts/Player/PlayerSkillTree.cs
Tomáš Pěnkava 630c54f7ff Potion Logic
Most of the potion logic for now
2025-08-02 02:54:53 +02:00

73 lines
1.4 KiB
C#

using System.Collections.Generic;
using UnityEngine;
using System.Collections;
public class PlayerSkillTree
{
private static PlayerSkillTree _instance;
private PotionHandler potionHandler;
public static PlayerSkillTree Instance
{
get
{
if (_instance == null)
{
_instance = new PlayerSkillTree();
}
return _instance;
}
}
public enum Skills
{
Dash,
Reflection1,
Reflection2,
Shockwave,
Spin,
Potion,
Arrows1,
Arrows2
}
private List<Skills> playerSkills;
public PlayerSkillTree()
{
playerSkills = new List<Skills>();
potionHandler = new PotionHandler();
}
public void UnlockSkill(Skills skill, PotionHandler.PotionType potionType)
{
if(skill == Skills.Potion){
potionHandler.AddPotion(potionType);
return;
}
if (playerSkills.Contains(skill)) return;
playerSkills.Add(skill);
}
public bool TryUsePotion(PotionHandler.PotionType potionType)
{
if(potionHandler.IsEmpty(potionType)) return false;
return potionHandler.UsePotion(potionType);
}
public bool IsSkillUnlocked(Skills skill)
{
return playerSkills.Contains(skill);
}
public List<Skills> GetPlayerSkills() { return playerSkills; }
}