using System.Collections;
using System.Collections.Generic;
using GameCreator.Runtime.Behavior;
using UnityEngine;
using Sirenix.OdinInspector;

public class SetTarget : MonoBehaviour
{
    [SerializeField] private Processor _processor;
    public Processor processor {
        get {
            if(_processor == null) {
                _processor = GetComponent<Processor>();
            }
            return _processor;
        }
    }

    [SerializeField] private GooglyEyeAdder _googlyEyeAdder;
    public GooglyEyeAdder googlyEyeAdder {
        get {
            if(_googlyEyeAdder == null) {
                _googlyEyeAdder = GetComponent<GooglyEyeAdder>();
            }
            return _googlyEyeAdder;
        }
    }

    [Button]
    public void SetProcessorTarget(GameObject target)
    {
        processor.RuntimeData.SetParameter("Target", target);
        processor.Restart();

        processor.enabled = false;
        processor.enabled = true;

        googlyEyeAdder.LookAt(target.transform);
    }
}
