using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

namespace Kryz.CharacterStats.Examples
{
    public class CharacterStats : MonoBehaviour
    {
        public CharacterStat Strength;
        public CharacterStat Agility;
        public CharacterStat Intelligence;
        public CharacterStat Spirit;
        public CharacterStat Vitality;

        public Dictionary<string, CharacterStat> statsDictionary = new Dictionary<string, CharacterStat>();

        public UnityEvent onUpdateStatValues = new UnityEvent();

        protected virtual void Awake()
        {
            statsDictionary.Add(nameof(Strength).ToLower(), Strength);
            statsDictionary.Add(nameof(Agility).ToLower(), Agility);
            statsDictionary.Add(nameof(Intelligence).ToLower(), Intelligence);
            statsDictionary.Add(nameof(Spirit).ToLower(), Spirit);
            statsDictionary.Add(nameof(Vitality).ToLower(), Vitality);
        }

        public void IncreaseAllStatPoints(int amount)
        {
            Strength.BaseValue += amount;
            Agility.BaseValue += amount;
            Intelligence.BaseValue += amount;
            Spirit.BaseValue += amount;
            Vitality.BaseValue += amount;

            onUpdateStatValues.Invoke();
        }
    }
}