XP points [SOLVED]
Posted: Thu Dec 19, 2019 7:48 am
How do I tie my own experience points into Quest Machine? That is, I would like a quest to give the player some experience points. Can I use a simple trigger to add experience or does it require further coding? Here's my code for tracking player experience points:
Thank you for any help or suggestions!
Code: Select all
public class Experience : MonoBehaviour, ISaveable
{
[SerializeField] float experiencePoints = 0;
public event Action onExperienceGained;
public void GainExperience(float experience)
{
experiencePoints += experience;
onExperienceGained();
}
public float GetPoints()
{
return experiencePoints;
}
public object CaptureState()
{
return experiencePoints;
}
public void RestoreState(object state)
{
experiencePoints = (float)state;
}
}