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

using System;
using System.Threading.Tasks;
using GameCreator.Runtime.Common;
using UnityEngine;

namespace BansheeGz.BGDatabase
{
    /// <summary>
    /// abstract database setter
    /// </summary>
    [Serializable]
    public abstract class BGGCSetA : BGGCCellA
    {
        protected override Task Run(Args args)
        {
            var cell = GetCell(args);
            if (cell == null) Debug.Log("WARNING! BGDatabase: target cell is not found!");
            else Set(args, cell.Value);

            return DefaultResult;
        }

        protected abstract void Set(Args args, BGGCCell cell);
    }
}