using System.Collections; using System.Collections.Generic; using UnityEngine; public class FlyWand : MonoBehaviour { private GameObject player; private bool isFlying; public float flySpeed = 10f; private void Awake() { player = GameObject.FindGameObjectWithTag("Player"); isFlying = false; } private void Update() { if (isFlying) { player.transform.position += transform.up * flySpeed * Time.deltaTime; } } public void EnableFly() { isFlying = true; } public void DisableFly() { isFlying = false; } }