mirror of
https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git
synced 2025-01-22 07:08:51 -05:00
Created Golf Control system
This commit is contained in:
parent
a6758c4726
commit
f8e7f1bc4f
8
Assets/GolfControls.meta
Normal file
8
Assets/GolfControls.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b603e0dd0e6dbec408679f5574573212
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
13
Assets/GolfControls/ControlConfiguration.cs
Normal file
13
Assets/GolfControls/ControlConfiguration.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace GolfControls
|
||||||
|
{
|
||||||
|
public class ControlConfiguration : MonoBehaviour
|
||||||
|
{
|
||||||
|
public float ballDrag;
|
||||||
|
|
||||||
|
public float timeToMaxSeconds;
|
||||||
|
|
||||||
|
public float pauseTimeSeconds;
|
||||||
|
}
|
||||||
|
}
|
11
Assets/GolfControls/ControlConfiguration.cs.meta
Normal file
11
Assets/GolfControls/ControlConfiguration.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b095958bcf82f8748a4aa4f0011cbdba
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
49
Assets/GolfControls/DirectionArrow.cs
Normal file
49
Assets/GolfControls/DirectionArrow.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace GolfControls
|
||||||
|
{
|
||||||
|
public class DirectionArrow : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private LineRenderer lineRenderer;
|
||||||
|
[SerializeField] private float lineLength = 0.5f;
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
GolfControl.BallPositionUpdated += UpdatePos;
|
||||||
|
GolfControl.ForceDirectionUpdated += UpdateLine;
|
||||||
|
GolfControl.PowerPercentFinalized += OnBallHit;
|
||||||
|
GolfControl.BallStoppedAtPosition += OnBallStopped;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
GolfControl.BallPositionUpdated -= UpdatePos;
|
||||||
|
GolfControl.ForceDirectionUpdated -= UpdateLine;
|
||||||
|
GolfControl.PowerPercentFinalized -= OnBallHit;
|
||||||
|
GolfControl.BallStoppedAtPosition -= OnBallStopped;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdatePos(Vector3 pos)
|
||||||
|
{
|
||||||
|
transform.position = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateLine(Vector3 direction)
|
||||||
|
{
|
||||||
|
lineRenderer.SetPosition(0,Vector3.zero);
|
||||||
|
lineRenderer.SetPosition(1,direction.normalized*lineLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBallHit(float _)
|
||||||
|
{
|
||||||
|
lineRenderer.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBallStopped(Vector3 ballPosition)
|
||||||
|
{
|
||||||
|
UpdatePos(ballPosition);
|
||||||
|
lineRenderer.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Assets/GolfControls/DirectionArrow.cs.meta
Normal file
11
Assets/GolfControls/DirectionArrow.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d4a6905107947ce46a668afb0b78b7da
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
21
Assets/GolfControls/Goal.cs
Normal file
21
Assets/GolfControls/Goal.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace GolfControls
|
||||||
|
{
|
||||||
|
public class Goal : MonoBehaviour
|
||||||
|
{
|
||||||
|
public delegate void basicDelegate();
|
||||||
|
public static basicDelegate GoalHit;
|
||||||
|
|
||||||
|
public MeshRenderer myMeshRenderer;
|
||||||
|
|
||||||
|
public Material Material;
|
||||||
|
|
||||||
|
public void OnTriggerEnter(Collider other)
|
||||||
|
{
|
||||||
|
myMeshRenderer.material = Material;
|
||||||
|
GoalHit?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/GolfControls/Goal.cs.meta
Normal file
11
Assets/GolfControls/Goal.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c383db349f0944448e5ffd8b2f6b1b0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
36
Assets/GolfControls/GolfBallController.cs
Normal file
36
Assets/GolfControls/GolfBallController.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace GolfControls
|
||||||
|
{
|
||||||
|
public class GolfBallController : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private Rigidbody ballBody;
|
||||||
|
[SerializeField] private float baseForce = 1.0f;
|
||||||
|
private Vector3 hitAngle = Vector3.zero;
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
GolfControl.ForceDirectionUpdated += UpdateHitAngle;
|
||||||
|
GolfControl.PowerPercentFinalized += BeginHit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
GolfControl.ForceDirectionUpdated -= UpdateHitAngle;
|
||||||
|
GolfControl.PowerPercentFinalized -= BeginHit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateHitAngle(Vector3 vec)
|
||||||
|
{
|
||||||
|
hitAngle = vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BeginHit(float force)
|
||||||
|
{
|
||||||
|
Vector3 hitVector = hitAngle.normalized * (force * baseForce);
|
||||||
|
ballBody.AddForce(hitVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Assets/GolfControls/GolfBallController.cs.meta
Normal file
11
Assets/GolfControls/GolfBallController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 742ea8a890ccc9341bd50ce81f21c9a5
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
196
Assets/GolfControls/GolfControl.cs
Normal file
196
Assets/GolfControls/GolfControl.cs
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace GolfControls
|
||||||
|
{
|
||||||
|
public class GolfControl : MonoBehaviour
|
||||||
|
{
|
||||||
|
public delegate void vector3Delegate(Vector3 vector);
|
||||||
|
public delegate void floatDelegate(float value);
|
||||||
|
public delegate void intDelegate(int value);
|
||||||
|
|
||||||
|
public static floatDelegate PowerPercentUpdated;
|
||||||
|
public static floatDelegate PowerPercentFinalized;
|
||||||
|
public static vector3Delegate ForceDirectionUpdated;
|
||||||
|
public static vector3Delegate BallPositionUpdated;
|
||||||
|
public static vector3Delegate BallStoppedAtPosition;
|
||||||
|
public static intDelegate strokeCountUpdated;
|
||||||
|
|
||||||
|
private bool buildingPower;
|
||||||
|
private bool ballIsMoving;
|
||||||
|
|
||||||
|
[SerializeField] private float timeToMaxPower = 1.0f;
|
||||||
|
[SerializeField] private float timeToMinPower = 1.0f;
|
||||||
|
[SerializeField] private float pauseTimeAtEnds = 0.05f;
|
||||||
|
|
||||||
|
[SerializeField] private Transform forceDirectionTransform;
|
||||||
|
[SerializeField] private Rigidbody ballBody;
|
||||||
|
[SerializeField] private float baseForce = 1.0f;
|
||||||
|
private Vector3 hitAngle = Vector3.zero;
|
||||||
|
|
||||||
|
private int strokeCount;
|
||||||
|
|
||||||
|
private bool inGoal;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
StartCoroutine(UpdateHitAngle());
|
||||||
|
strokeCount = 1;
|
||||||
|
strokeCountUpdated?.Invoke(strokeCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
Goal.GoalHit += OnGoalHit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
Goal.GoalHit -= OnGoalHit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGoalHit()
|
||||||
|
{
|
||||||
|
ballBody.velocity = Vector3.zero;
|
||||||
|
inGoal = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ToggleSlide()
|
||||||
|
{
|
||||||
|
if (ballIsMoving) return;
|
||||||
|
buildingPower = !buildingPower;
|
||||||
|
if (buildingPower)
|
||||||
|
{
|
||||||
|
StartCoroutine(SlidePower());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator UpdateHitAngle()
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
|
||||||
|
BallPositionUpdated?.Invoke(ballBody.transform.position);
|
||||||
|
|
||||||
|
Vector3 ballPos = ballBody.transform.position;
|
||||||
|
Vector3 angleSourcePos = forceDirectionTransform.position;
|
||||||
|
|
||||||
|
Vector3 positionDifference = ballPos - angleSourcePos;
|
||||||
|
|
||||||
|
Vector3 forceVector = Vector3.ProjectOnPlane(positionDifference,Vector3.down);
|
||||||
|
ForceDirectionUpdated?.Invoke(forceVector);
|
||||||
|
hitAngle = forceVector;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator SlidePower()
|
||||||
|
{
|
||||||
|
float timer = 0;
|
||||||
|
|
||||||
|
bool goingUp = true;
|
||||||
|
float timerGoal = timeToMaxPower;
|
||||||
|
|
||||||
|
float outputPercent = 0.0f;
|
||||||
|
|
||||||
|
while (buildingPower)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
|
||||||
|
if (inGoal) yield break;
|
||||||
|
|
||||||
|
timer += Time.deltaTime;
|
||||||
|
float percentTime = timer / timerGoal;
|
||||||
|
|
||||||
|
outputPercent = goingUp ? percentTime : 1.0f - percentTime;
|
||||||
|
|
||||||
|
PowerPercentUpdated?.Invoke(outputPercent);
|
||||||
|
|
||||||
|
if (percentTime < 1.0f) continue;
|
||||||
|
|
||||||
|
//Bounce back starts here
|
||||||
|
|
||||||
|
percentTime = 1.0f;
|
||||||
|
outputPercent = goingUp ? percentTime : 1.0f - percentTime;
|
||||||
|
PowerPercentUpdated?.Invoke(outputPercent);
|
||||||
|
|
||||||
|
float pauseTimer = 0.0f;
|
||||||
|
while (buildingPower && pauseTimer < pauseTimeAtEnds)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
pauseTimer += Time.deltaTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
SwapDirection();
|
||||||
|
}
|
||||||
|
|
||||||
|
PowerPercentUpdated?.Invoke(0);
|
||||||
|
PowerPercentFinalized?.Invoke(outputPercent);
|
||||||
|
|
||||||
|
Vector3 hitVector = hitAngle.normalized * (outputPercent * baseForce);
|
||||||
|
ballBody.AddForce(hitVector);
|
||||||
|
|
||||||
|
StartCoroutine(TrackingBall());
|
||||||
|
|
||||||
|
void SwapDirection()
|
||||||
|
{
|
||||||
|
goingUp = !goingUp;
|
||||||
|
timerGoal = goingUp ? timeToMaxPower : timeToMinPower;
|
||||||
|
timer = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Assets/GolfControls/GolfControl.cs.meta
Normal file
11
Assets/GolfControls/GolfControl.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a5e3cbe56ffba194f918c58a33a3a411
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
1938
Assets/GolfControls/GolfObjects.prefab
Normal file
1938
Assets/GolfControls/GolfObjects.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/GolfControls/GolfObjects.prefab.meta
Normal file
7
Assets/GolfControls/GolfObjects.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f33630b3f8cb5c0458205dd121e46b41
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
137
Assets/GolfControls/LightBlueMat.mat
Normal file
137
Assets/GolfControls/LightBlueMat.mat
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-5391614527772318277
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 11
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
version: 7
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 8
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: LightBlueMat
|
||||||
|
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||||
|
m_Parent: {fileID: 0}
|
||||||
|
m_ModifiedSerializedProperties: 0
|
||||||
|
m_ValidKeywords:
|
||||||
|
- _ALPHAPREMULTIPLY_ON
|
||||||
|
- _SURFACE_TYPE_TRANSPARENT
|
||||||
|
m_InvalidKeywords: []
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: 3000
|
||||||
|
stringTagMap:
|
||||||
|
RenderType: Transparent
|
||||||
|
disabledShaderPasses:
|
||||||
|
- DepthOnly
|
||||||
|
- SHADOWCASTER
|
||||||
|
m_LockedProperties:
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BaseMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MetallicGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _OcclusionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ParallaxMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _SpecGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_Lightmaps:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_LightmapsInd:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_ShadowMasks:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Ints: []
|
||||||
|
m_Floats:
|
||||||
|
- _AlphaClip: 0
|
||||||
|
- _AlphaToMask: 0
|
||||||
|
- _Blend: 0
|
||||||
|
- _BlendModePreserveSpecular: 1
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _ClearCoatMask: 0
|
||||||
|
- _ClearCoatSmoothness: 0
|
||||||
|
- _Cull: 2
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailAlbedoMapScale: 1
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 10
|
||||||
|
- _DstBlendAlpha: 10
|
||||||
|
- _EnvironmentReflections: 1
|
||||||
|
- _GlossMapScale: 0
|
||||||
|
- _Glossiness: 0
|
||||||
|
- _GlossyReflections: 0
|
||||||
|
- _Metallic: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.005
|
||||||
|
- _QueueOffset: 0
|
||||||
|
- _ReceiveShadows: 1
|
||||||
|
- _Smoothness: 0.5
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _SrcBlendAlpha: 1
|
||||||
|
- _Surface: 1
|
||||||
|
- _WorkflowMode: 1
|
||||||
|
- _ZWrite: 0
|
||||||
|
m_Colors:
|
||||||
|
- _BaseColor: {r: 0, g: 1, b: 0.84887123, a: 0.89411765}
|
||||||
|
- _Color: {r: 0, g: 1, b: 0.84887123, a: 0.89411765}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
8
Assets/GolfControls/LightBlueMat.mat.meta
Normal file
8
Assets/GolfControls/LightBlueMat.mat.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fe0b1757fa9fa8d47a57da9423786da6
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
137
Assets/GolfControls/LightGreenMat.mat
Normal file
137
Assets/GolfControls/LightGreenMat.mat
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-5391614527772318277
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 11
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
version: 7
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 8
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: LightGreenMat
|
||||||
|
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||||
|
m_Parent: {fileID: 0}
|
||||||
|
m_ModifiedSerializedProperties: 0
|
||||||
|
m_ValidKeywords:
|
||||||
|
- _ALPHAPREMULTIPLY_ON
|
||||||
|
- _SURFACE_TYPE_TRANSPARENT
|
||||||
|
m_InvalidKeywords: []
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: 3000
|
||||||
|
stringTagMap:
|
||||||
|
RenderType: Transparent
|
||||||
|
disabledShaderPasses:
|
||||||
|
- DepthOnly
|
||||||
|
- SHADOWCASTER
|
||||||
|
m_LockedProperties:
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BaseMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MetallicGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _OcclusionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ParallaxMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _SpecGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_Lightmaps:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_LightmapsInd:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_ShadowMasks:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Ints: []
|
||||||
|
m_Floats:
|
||||||
|
- _AlphaClip: 0
|
||||||
|
- _AlphaToMask: 0
|
||||||
|
- _Blend: 0
|
||||||
|
- _BlendModePreserveSpecular: 1
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _ClearCoatMask: 0
|
||||||
|
- _ClearCoatSmoothness: 0
|
||||||
|
- _Cull: 2
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailAlbedoMapScale: 1
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 10
|
||||||
|
- _DstBlendAlpha: 10
|
||||||
|
- _EnvironmentReflections: 1
|
||||||
|
- _GlossMapScale: 0
|
||||||
|
- _Glossiness: 0
|
||||||
|
- _GlossyReflections: 0
|
||||||
|
- _Metallic: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.005
|
||||||
|
- _QueueOffset: 0
|
||||||
|
- _ReceiveShadows: 1
|
||||||
|
- _Smoothness: 0.5
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _SrcBlendAlpha: 1
|
||||||
|
- _Surface: 1
|
||||||
|
- _WorkflowMode: 1
|
||||||
|
- _ZWrite: 0
|
||||||
|
m_Colors:
|
||||||
|
- _BaseColor: {r: 0.12372565, g: 1, b: 0, a: 0.5882353}
|
||||||
|
- _Color: {r: 0.12372563, g: 1, b: 0, a: 0.5882353}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
8
Assets/GolfControls/LightGreenMat.mat.meta
Normal file
8
Assets/GolfControls/LightGreenMat.mat.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d1c2dd36238620e4191308075fbf7f84
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
8
Assets/GolfControls/UI.meta
Normal file
8
Assets/GolfControls/UI.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 29634d42a838f9d45a78464d52acf96d
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
32
Assets/GolfControls/UI/PowerBarDisplay.cs
Normal file
32
Assets/GolfControls/UI/PowerBarDisplay.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace GolfControls
|
||||||
|
{
|
||||||
|
public class PowerBarDisplay : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]private RectTransform barRect;
|
||||||
|
[SerializeField]private RectTransform fullRect;
|
||||||
|
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
GolfControl.PowerPercentUpdated += UpdateDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
GolfControl.PowerPercentUpdated -= UpdateDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateDisplay(float percent)
|
||||||
|
{
|
||||||
|
float width = fullRect.sizeDelta.x;
|
||||||
|
float maxHeight = fullRect.sizeDelta.y;
|
||||||
|
|
||||||
|
float scaledHeight = maxHeight * percent;
|
||||||
|
|
||||||
|
barRect.sizeDelta = new Vector2(width,scaledHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/GolfControls/UI/PowerBarDisplay.cs.meta
Normal file
11
Assets/GolfControls/UI/PowerBarDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1f529ce348a22904a9ab8eeb79569f5a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
37
Assets/GolfControls/UI/StrokeDisplay.cs
Normal file
37
Assets/GolfControls/UI/StrokeDisplay.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace GolfControls.UI
|
||||||
|
{
|
||||||
|
public class StrokeDisplay : MonoBehaviour
|
||||||
|
{
|
||||||
|
public TextMeshProUGUI numText;
|
||||||
|
|
||||||
|
private int currentStrokeCount;
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
GolfControl.strokeCountUpdated += UpdateText;
|
||||||
|
Goal.GoalHit += OnGoal;
|
||||||
|
}
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
GolfControl.strokeCountUpdated -= UpdateText;
|
||||||
|
Goal.GoalHit -= OnGoal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateText(int value)
|
||||||
|
{
|
||||||
|
currentStrokeCount = value;
|
||||||
|
numText.text = value.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGoal()
|
||||||
|
{
|
||||||
|
numText.text = "GOAL AT: " + currentStrokeCount;
|
||||||
|
numText.color = Color.green;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
11
Assets/GolfControls/UI/StrokeDisplay.cs.meta
Normal file
11
Assets/GolfControls/UI/StrokeDisplay.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 93f875f5caf89c74c8bf7325138db5c2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
3997
Assets/Scenes/TestControls.unity
Normal file
3997
Assets/Scenes/TestControls.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/TestControls.unity.meta
Normal file
7
Assets/Scenes/TestControls.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 158e3ae0499b94748afd3d0bea63cfec
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -72,6 +72,7 @@ MonoBehaviour:
|
|||||||
m_ColorGradingMode: 0
|
m_ColorGradingMode: 0
|
||||||
m_ColorGradingLutSize: 16
|
m_ColorGradingLutSize: 16
|
||||||
m_UseFastSRGBLinearConversion: 0
|
m_UseFastSRGBLinearConversion: 0
|
||||||
|
m_SupportDataDrivenLensFlare: 1
|
||||||
m_ShadowType: 1
|
m_ShadowType: 1
|
||||||
m_LocalShadowsSupported: 0
|
m_LocalShadowsSupported: 0
|
||||||
m_LocalShadowsAtlasResolution: 256
|
m_LocalShadowsAtlasResolution: 256
|
||||||
@ -103,6 +104,10 @@ MonoBehaviour:
|
|||||||
m_PrefilterDBufferMRT1: 1
|
m_PrefilterDBufferMRT1: 1
|
||||||
m_PrefilterDBufferMRT2: 1
|
m_PrefilterDBufferMRT2: 1
|
||||||
m_PrefilterDBufferMRT3: 1
|
m_PrefilterDBufferMRT3: 1
|
||||||
|
m_PrefilterSoftShadowsQualityLow: 1
|
||||||
|
m_PrefilterSoftShadowsQualityMedium: 0
|
||||||
|
m_PrefilterSoftShadowsQualityHigh: 1
|
||||||
|
m_PrefilterSoftShadows: 1
|
||||||
m_PrefilterScreenCoord: 1
|
m_PrefilterScreenCoord: 1
|
||||||
m_PrefilterNativeRenderPass: 1
|
m_PrefilterNativeRenderPass: 1
|
||||||
m_ShaderVariantLogLevel: 0
|
m_ShaderVariantLogLevel: 0
|
||||||
|
@ -5,9 +5,12 @@ EditorBuildSettings:
|
|||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes:
|
m_Scenes:
|
||||||
- enabled: 1
|
- enabled: 0
|
||||||
path: Assets/Scenes/SampleScene.unity
|
path: Assets/Scenes/SampleScene.unity
|
||||||
guid: 4755b35b590504809a7525fd2109c2e2
|
guid: 4755b35b590504809a7525fd2109c2e2
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/TestControls.unity
|
||||||
|
guid: 158e3ae0499b94748afd3d0bea63cfec
|
||||||
m_configObjects:
|
m_configObjects:
|
||||||
UnityEditor.XR.ARCore.ARCoreSettings: {fileID: 11400000, guid: 6ee72d15cf39dd748a13eac57397b9af,
|
UnityEditor.XR.ARCore.ARCoreSettings: {fileID: 11400000, guid: 6ee72d15cf39dd748a13eac57397b9af,
|
||||||
type: 2}
|
type: 2}
|
||||||
|
@ -8,7 +8,7 @@ PlayerSettings:
|
|||||||
AndroidProfiler: 0
|
AndroidProfiler: 0
|
||||||
AndroidFilterTouchesWhenObscured: 0
|
AndroidFilterTouchesWhenObscured: 0
|
||||||
AndroidEnableSustainedPerformanceMode: 0
|
AndroidEnableSustainedPerformanceMode: 0
|
||||||
defaultScreenOrientation: 0
|
defaultScreenOrientation: 4
|
||||||
targetDevice: 2
|
targetDevice: 2
|
||||||
useOnDemandResources: 0
|
useOnDemandResources: 0
|
||||||
accelerometerFrequency: 60
|
accelerometerFrequency: 60
|
||||||
@ -58,8 +58,8 @@ PlayerSettings:
|
|||||||
iosShowActivityIndicatorOnLoading: -1
|
iosShowActivityIndicatorOnLoading: -1
|
||||||
androidShowActivityIndicatorOnLoading: -1
|
androidShowActivityIndicatorOnLoading: -1
|
||||||
iosUseCustomAppBackgroundBehavior: 0
|
iosUseCustomAppBackgroundBehavior: 0
|
||||||
allowedAutorotateToPortrait: 1
|
allowedAutorotateToPortrait: 0
|
||||||
allowedAutorotateToPortraitUpsideDown: 1
|
allowedAutorotateToPortraitUpsideDown: 0
|
||||||
allowedAutorotateToLandscapeRight: 1
|
allowedAutorotateToLandscapeRight: 1
|
||||||
allowedAutorotateToLandscapeLeft: 1
|
allowedAutorotateToLandscapeLeft: 1
|
||||||
useOSAutorotation: 1
|
useOSAutorotation: 1
|
||||||
@ -140,7 +140,11 @@ PlayerSettings:
|
|||||||
visionOSBundleVersion: 1.0
|
visionOSBundleVersion: 1.0
|
||||||
tvOSBundleVersion: 1.0
|
tvOSBundleVersion: 1.0
|
||||||
bundleVersion: 1.0.0
|
bundleVersion: 1.0.0
|
||||||
preloadedAssets: []
|
preloadedAssets:
|
||||||
|
- {fileID: 7409956309476867576, guid: 3fd4fc0127790db4bae83f7b77da8d45, type: 2}
|
||||||
|
- {fileID: 11400000, guid: c199e683398494f32b4cde18e73ab731, type: 2}
|
||||||
|
- {fileID: 4800000, guid: c9f956787b1d945e7b36e0516201fc76, type: 3}
|
||||||
|
- {fileID: 4800000, guid: 0945859e5a1034c2cb6dce53cb4fb899, type: 3}
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
m_HolographicPauseOnTrackingLoss: 1
|
m_HolographicPauseOnTrackingLoss: 1
|
||||||
@ -833,7 +837,7 @@ PlayerSettings:
|
|||||||
m_RenderingPath: 1
|
m_RenderingPath: 1
|
||||||
m_MobileRenderingPath: 1
|
m_MobileRenderingPath: 1
|
||||||
metroPackageName: UDRIGolf2024
|
metroPackageName: UDRIGolf2024
|
||||||
metroPackageVersion:
|
metroPackageVersion: 1.0.0.0
|
||||||
metroCertificatePath:
|
metroCertificatePath:
|
||||||
metroCertificatePassword:
|
metroCertificatePassword:
|
||||||
metroCertificateSubject:
|
metroCertificateSubject:
|
||||||
@ -841,7 +845,7 @@ PlayerSettings:
|
|||||||
metroCertificateNotAfter: 0000000000000000
|
metroCertificateNotAfter: 0000000000000000
|
||||||
metroApplicationDescription: UDRIGolf2024
|
metroApplicationDescription: UDRIGolf2024
|
||||||
wsaImages: {}
|
wsaImages: {}
|
||||||
metroTileShortName:
|
metroTileShortName: UDRIGolf2024
|
||||||
metroTileShowName: 0
|
metroTileShowName: 0
|
||||||
metroMediumTileShowName: 0
|
metroMediumTileShowName: 0
|
||||||
metroLargeTileShowName: 0
|
metroLargeTileShowName: 0
|
||||||
|
Loading…
Reference in New Issue
Block a user