proto_racer/Assets/Scripts/Wheel.cs

20 lines
332 B
C#
Raw Normal View History

using System;
using UnityEngine;
[RequireComponent(typeof(Collider2D))]
public class Wheel : MonoBehaviour
{
public Action wheelOffRoad;
public Action wheelOnRoad;
private void OnTriggerExit2D(Collider2D other)
{
wheelOffRoad?.Invoke();
}
private void OnTriggerEnter2D(Collider2D other)
{
wheelOnRoad?.Invoke();
}
}