20 lines
332 B
C#
20 lines
332 B
C#
|
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();
|
||
|
}
|
||
|
}
|