﻿/*
<copyright file="BGGCGetA.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 getter
    /// </summary>
    [Serializable]
    public abstract class BGGCGetA : BGGCCellA
    {
        protected override Task Run(Args args)
        {
            var cell = GetCell(args);
            if (cell == null) Debug.Log("WARNING! BGDatabase: can not access a target cell!");
            else Set(cell.Value, args);
            return DefaultResult;
        }
        protected abstract void Set(BGGCCell cell, Args args);
    }
}
