mirror of
https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git
synced 2025-01-22 07:08:51 -05:00
Removed redundant master control script
This commit is contained in:
parent
ed602919cc
commit
47c18714d2
@ -1,81 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GolfControls
|
||||
{
|
||||
public class GolfControl : MonoBehaviour
|
||||
{
|
||||
public delegate void vector3Delegate(Vector3 vector);
|
||||
public delegate void intDelegate(int value);
|
||||
|
||||
public static vector3Delegate BallStoppedAtPosition;
|
||||
public static intDelegate strokeCountUpdated;
|
||||
|
||||
float outputPercent = 0.0f;
|
||||
private bool ballIsMoving;
|
||||
|
||||
[SerializeField] private Rigidbody ballBody;
|
||||
|
||||
private int strokeCount;
|
||||
|
||||
private bool inGoal;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
strokeCount = 1;
|
||||
strokeCountUpdated?.Invoke(strokeCount);
|
||||
}
|
||||
|
||||
|
||||
private IEnumerator TrackingBall()
|
||||
{
|
||||
float minVelocityMagnitude = 0.1f;
|
||||
float ballStopTime = 1.0f;
|
||||
|
||||
ballIsMoving = true;
|
||||
|
||||
while (true)
|
||||
{
|
||||
yield return null;
|
||||
|
||||
if (inGoal) yield break;
|
||||
|
||||
if(ballBody.velocity.magnitude >= minVelocityMagnitude) continue;
|
||||
|
||||
float timer = 0.0f;
|
||||
|
||||
bool isStopped = true;
|
||||
|
||||
while (timer < ballStopTime)
|
||||
{
|
||||
yield return null;
|
||||
|
||||
if (inGoal) yield break;
|
||||
|
||||
timer += Time.deltaTime;
|
||||
|
||||
if (ballBody.velocity.magnitude > minVelocityMagnitude)
|
||||
{
|
||||
isStopped = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isStopped) break;
|
||||
}
|
||||
|
||||
ballBody.velocity = Vector3.zero;
|
||||
ballIsMoving = false;
|
||||
|
||||
if (inGoal) yield break;
|
||||
|
||||
strokeCount++;
|
||||
strokeCountUpdated?.Invoke(strokeCount);
|
||||
|
||||
BallStoppedAtPosition?.Invoke(ballBody.transform.position);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5e3cbe56ffba194f918c58a33a3a411
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -2331,7 +2331,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1807783553}
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c2fadf230d1919748a9aa21d40f74619, type: 3}
|
||||
m_Name:
|
||||
@ -2541,7 +2541,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1867824958
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
Loading…
Reference in New Issue
Block a user