add project files
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using OHM.UnityToolkit;
|
||||
using OHM.UnityToolkit.Vibration;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class CheckpointsHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
[FormerlySerializedAs("passCheckpoint")]
|
||||
private SFX _passCheckpoint;
|
||||
|
||||
public Checkpoints lastCheckpoint { get; private set; }
|
||||
|
||||
public event Action<Checkpoints> onCheckpoints;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
Checkpoints checkpoint = other.GetComponentInParent<Checkpoints>();
|
||||
if (!(checkpoint == null) && !checkpoint.isPass)
|
||||
{
|
||||
lastCheckpoint = checkpoint;
|
||||
checkpoint.PassCheckpoint();
|
||||
_passCheckpoint.Play(base.transform);
|
||||
VibrationManager.Vibrate(VibrationManager.VibrationType.MEDIUM);
|
||||
if (this.onCheckpoints != null)
|
||||
{
|
||||
this.onCheckpoints(checkpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UnPause(bool success)
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user