Created
February 18, 2022 11:03
-
-
Save partiallyblind/02ec959994e58980dc64a77b0d817c25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TeleportScript : MonoBehaviour | |
{ | |
void OnEnable() | |
{ | |
EventManager.OnClicked += Teleport; | |
} | |
void OnDisable() | |
{ | |
EventManager.OnClicked -= Teleport; | |
} | |
void Teleport() | |
{ | |
Vector3 pos = transform.position; | |
pos.y = Random.Range(1.0f, 3.0f); | |
transform.position = pos; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment