using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EffectSpawner : MonoBehaviour
{
    public GameObject Effect;

    public GameObject EffectInstance;

    public GameObject GravityObject;

    public void Start()
    {
        if (GravityObject == null)
        {
            GravityObject = GameObject.FindWithTag("GravitySource");
        }

        EffectInstance = GameObject.Instantiate(Effect);
        EffectInstance.transform.position = this.transform.position;
        EffectInstance.transform.LookAt(GravityObject.transform.position);
        EffectInstance.transform.Rotate(new Vector3(-90, 0, 0));
    }

    public void Update()
    {
        if (EffectInstance != null)
        {
            EffectInstance.transform.position = this.transform.position;
        }
    }
}
