using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class FlyWand : MonoBehaviour
{
    private GameObject player;
    private bool isFlying;

    public ParticleSystem particles;
    public float flySpeed = 10f;
    public float testForce;

    private void Awake()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        isFlying = false;
    }


    private void Update()
    {
        if (isFlying)
        {
            //player.transform.position += transform.up * flySpeed * Time.deltaTime;
            player.GetComponent<Rigidbody>().AddForce(-transform.up * testForce * Time.deltaTime);
        }
    }

    public void EnableFly()
    {
        isFlying = true;
        particles.Play();
    }

    public void DisableFly()
    {
        isFlying = false;
        particles.Stop();
        particles.Clear();
    }
}