using System;
using System.Collections;
using UnityEngine;

[CreateAssetMenu(fileName = "PlayerData", menuName = "ScriptableObjects/Player")]
public sealed class PlayerData : ScriptableObject
{
    // Serialize Fields
    [field: SerializeField] public int InvincibilityTime { get; protected set; }
    [field: SerializeField] public float JumpHeight { get; private set; }
    [field: SerializeField] public float LaneSwitchSpeed { get; private set; }
    [field: SerializeField] public float InitialSpeed { get; private set; }
    [field: SerializeField] public float CurrentSpeed { get; private set; }
    [field: SerializeField] public float SpeedAcceleration { get; private set; }

    // Other attributes
    private bool onPause = false;
    
    private void Awake()
    {
        CurrentSpeed = InitialSpeed;
    }

    public void Reset()
    {
        CurrentSpeed = InitialSpeed;
    }
    
    public void Update()
    {
        if (!onPause)
           CurrentSpeed += SpeedAcceleration / 1000;
    }

    public void isPaused(bool isPaused)
    {
        onPause = isPaused;
    }
}
