/*
<copyright file="BGBDSaveLoadA.cs" company="BansheeGz">
    Copyright (c) 2018-2021 All Rights Reserved
</copyright>
*/

using System.IO;
using System.Xml.Linq;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;
using UnityEngine;
using Application = UnityEngine.Application;

namespace BansheeGz.BGDatabase
{
    public abstract class BGBDSaveLoadA : BGBDActionA
    {
        public const string FileExt = "sav";
        public SharedString fileName;
        public SharedBool debug;

        protected string FilePath => Path.ChangeExtension(Path.Combine(Application.persistentDataPath, fileName.Value), FileExt);

        
        protected override void Execute()
        {
            FileAction();
        }

        protected abstract void FileAction();

        protected void Log(string message)
        {
            if (!debug.Value) return;
            Debug.Log(message);
        }
    }
}