using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using static CommunicationEvents;

public class Remover : Gadget
{
    /// \copydoc Gadget.s_type
    [Newtonsoft.Json.JsonProperty]
    protected static new string s_type = "Remover";


    public override void _Hit(RaycastHit[] hit)
    {
        bool samestep = false;
        foreach (string uri in hit.Select(h => h.transform.GetComponent<FactObject>()?.URI))
        {
            if(uri == null)
                continue;

            Workflow.Add(uri);
            StageStatic.stage.factState.Remove(Workflow.Last(), samestep, gadget: this);

            samestep = true;
        }

        ResetGadget();
    }
}