35 lines
582 B
C#
35 lines
582 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class FlyWand : MonoBehaviour
|
|
{
|
|
private GameObject player;
|
|
private bool isFlying;
|
|
|
|
private void Awake()
|
|
{
|
|
player = GameObject.FindGameObjectWithTag("Player");
|
|
isFlying = false;
|
|
}
|
|
|
|
|
|
private void Update()
|
|
{
|
|
if (isFlying)
|
|
{
|
|
player.transform.position += transform.up * 0.5f;
|
|
}
|
|
}
|
|
|
|
public void EnableFly()
|
|
{
|
|
isFlying = true;
|
|
}
|
|
|
|
public void DisableFly()
|
|
{
|
|
isFlying = false;
|
|
}
|
|
}
|