using System.Collections; using System.Collections.Generic; using UnityEngine; public class TurnAround : MonoBehaviour { private bool turn = true; private void OnEnable() { PassTheEdgeTrigger.OnPassingTheEdge += StopTurning; } private void OnDisable() { PassTheEdgeTrigger.OnPassingTheEdge -= StopTurning; } public float Speed = 3.0f; void Update() { if (turn) { gameObject.transform.Rotate(Vector3.up / Speed); } } private void StopTurning() { turn = false; } }