Grabbing object and initial flying locomotion
This commit is contained in:
34
Assets/Project Files/Scripts/JoonasP/FlyWand.cs
Normal file
34
Assets/Project Files/Scripts/JoonasP/FlyWand.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
11
Assets/Project Files/Scripts/JoonasP/FlyWand.cs.meta
Normal file
11
Assets/Project Files/Scripts/JoonasP/FlyWand.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee8103568a01d804d89cb1fc1dff91eb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user