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


using System;
using GameCreator.Core;
using GameCreator.Variables;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace BansheeGz.BGDatabase
{
    public class BGGCDeleteRow : BGGCRowA
    {
        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            var entity = GetEntity(target);
            if (entity == null)
            {
                Debug.Log("WARNING! BGDatabase: can not access a target entity!");
                return true;
            }
            entity.Delete();

            return true;
        }
        
        // +--------------------------------------------------------------------------------------+
        // | EDITOR                                                                               |
        // +--------------------------------------------------------------------------------------+
#if UNITY_EDITOR
        public static new string NAME = "BansheeGz/Delete a row";
        protected override string Title => "BGDatabase: Delete a row";

#endif
    }
}