mirror of
https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git
synced 2025-01-22 15:18:25 -05:00
30 lines
620 B
C#
30 lines
620 B
C#
using System;
|
|
using UnityAtoms.BaseAtoms;
|
|
using UnityEngine;
|
|
|
|
namespace GolfControls
|
|
{
|
|
public class StrokeCounter : MonoBehaviour
|
|
{
|
|
public BoolVariable ballMovingVariable;
|
|
public IntVariable StrokeVariable;
|
|
public VoidEvent HitEvent;
|
|
|
|
private void OnEnable()
|
|
{
|
|
HitEvent.Register(OnHit);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
HitEvent.Unregister(OnHit);
|
|
}
|
|
|
|
private void OnHit()
|
|
{
|
|
if (ballMovingVariable.Value) return;
|
|
StrokeVariable.SetValue(StrokeVariable.Value+1);
|
|
}
|
|
}
|
|
}
|