1
0
mirror of https://projects.caleb-brown.dev/UDRI-XRT/UDRIGEEKCup2024.git synced 2025-01-21 22:58:50 -05:00

Merge pull request 'Sounds and Power Increase' (#29) from feature/Sounds-Power into development

Reviewed-on: https://udrimavric.com/MAVRIC/UDRIGolf2024/pulls/29
This commit is contained in:
Caleb Brown 2024-04-24 16:57:12 +00:00
commit 1f64320da5
16 changed files with 530 additions and 9 deletions

View File

@ -2,7 +2,7 @@ using System.Collections;
using UnityAtoms.BaseAtoms;
using UnityEngine;
namespace GolfControls
namespace MAVRIC.GEEKCup.GolfControls
{
public class BallHitController : MonoBehaviour
{
@ -18,6 +18,10 @@ namespace GolfControls
private Rigidbody body;
public AudioSource hitSoundSource;
private float minVelocityMagnitude = 0.1f;
private void Start()
{
body = gameObject.GetComponent<Rigidbody>();
@ -36,7 +40,9 @@ namespace GolfControls
private void OnHit()
{
if(isMovingVariable.Value) return;
if (body.velocity.magnitude >= minVelocityMagnitude) return;
hitSoundSource.Play();
Vector3 hitVector = AngleVariable.Value.normalized * (PowerVariable.Value * baseForce);
body.AddForce(hitVector);
StartCoroutine(TrackState());
@ -45,7 +51,6 @@ namespace GolfControls
private IEnumerator TrackState()
{
float minVelocityMagnitude = 0.1f;
float ballStopTime = 1.0f;
isMovingVariable.SetValue(true);

View File

@ -1,12 +1,29 @@
using System;
using UnityAtoms.BaseAtoms;
using UnityEngine;
namespace GolfControls
namespace MAVRIC.GEEKCup.GolfControls
{
public class StrokeCounter : MonoBehaviour
{
public IntVariable StrokeVariable;
public BoolEvent IsIncrementedEvent;
public int ParStrokeCount = 5;
public VoidEvent LossEvent;
private void OnEnable()
{
IsIncrementedEvent.Register(OnStrokeCountIncremented);
}
private void OnDisable()
{
IsIncrementedEvent.Unregister(OnStrokeCountIncremented);
}
public void OnHit(bool isHit)
{
if (!isHit)
@ -16,5 +33,16 @@ namespace GolfControls
StrokeVariable.SetValue(StrokeVariable.Value + 1);
}
private void OnStrokeCountIncremented(bool ballStartedHit)
{
if (ballStartedHit) return;
if (StrokeVariable.Value >= ParStrokeCount)
{
LossEvent.Raise();
}
}
}
}

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: 04d35e2eb934747da9d77a3af62bb8ca, type: 3}
m_Name: ParStrokeCountReached
m_EditorClassIdentifier:
_developerDescription:
_replayBufferSize: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6d75584e89af7e6488027b09813f11e6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -34,6 +34,7 @@ Transform:
- {fileID: 7529011191634243865}
- {fileID: 2969644529280671742}
- {fileID: 3631394724762200096}
- {fileID: 2734812901335878935}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3021524037178137395
@ -82,6 +83,175 @@ Transform:
m_Children: []
m_Father: {fileID: 1575695703629199926}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6950397858787610770
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2734812901335878935}
- component: {fileID: 4860048457319323441}
- component: {fileID: 6337772897861031450}
m_Layer: 0
m_Name: ParEvent
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2734812901335878935
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6950397858787610770}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1575695703629199926}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &4860048457319323441
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6950397858787610770}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 454f6ff3e51d5fd44ab84bb27b326036, type: 3}
m_PlayOnAwake: 0
m_Volume: 0.7
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &6337772897861031450
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6950397858787610770}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2458933140c54c9db0aec7a69c1b617, type: 3}
m_Name:
m_EditorClassIdentifier:
_developerDescription:
_unityEventResponse:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 4860048457319323441}
m_TargetAssemblyTypeName: UnityEngine.AudioSource, UnityEngine
m_MethodName: Play
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
_actionResponses: []
_conditions: []
_operator: 0
_replayEventBufferOnRegister: 1
_eventReference:
_usage: 0
_event: {fileID: 11400000, guid: 6d75584e89af7e6488027b09813f11e6, type: 2}
_eventInstancer: {fileID: 0}
_collection: {fileID: 0}
_list: {fileID: 0}
_collectionInstancer: {fileID: 0}
_listInstancer: {fileID: 0}
--- !u!1001 &2420978955236610172
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -63,9 +63,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 594dbcb0ac6fee442ac8e47c96781542, type: 3}
m_Name:
m_EditorClassIdentifier:
ballMovingVariable: {fileID: 11400000, guid: 838a13f5fd312c94398e49cfc36e34ad, type: 2}
StrokeVariable: {fileID: 11400000, guid: b17566f4d19813249a993793ac86d94c, type: 2}
HitEvent: {fileID: 11400000, guid: 90fa28c269919df41acdd37835ee3b9e, type: 2}
IsIncrementedEvent: {fileID: 11400000, guid: ec7d602226c7a4b4a9aeacaba953fc38, type: 2}
ParStrokeCount: 5
LossEvent: {fileID: 11400000, guid: 6d75584e89af7e6488027b09813f11e6, type: 2}
--- !u!114 &1229042045006618261
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -82,6 +82,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1969549356574266556}
m_TargetAssemblyTypeName: UnityEngine.AudioSource, UnityEngine
m_MethodName: Play
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
layerMask:
serializedVersion: 2
m_Bits: 1
@ -165,6 +177,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 8649987843805268783}
- component: {fileID: 1969549356574266556}
m_Layer: 7
m_Name: Hole
m_TagString: Untagged
@ -192,6 +205,102 @@ Transform:
- {fileID: 5490686123428067723}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &1969549356574266556
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6121683813469744371}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 8db469e270c7311428e074fc0d1000c1, type: 3}
m_PlayOnAwake: 0
m_Volume: 0.8
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &6783148664893773472
GameObject:
m_ObjectHideFlags: 0

View File

@ -17,6 +17,7 @@ GameObject:
- component: {fileID: 2848465825052700219}
- component: {fileID: 3220627860812539771}
- component: {fileID: 3638049900979181177}
- component: {fileID: 1555587377596854050}
m_Layer: 0
m_Name: TestGolfBall
m_TagString: Player
@ -171,7 +172,8 @@ MonoBehaviour:
PowerVariable: {fileID: 11400000, guid: b5aa4452d8d082d48b46495c7352e39e, type: 2}
isMovingVariable: {fileID: 11400000, guid: 838a13f5fd312c94398e49cfc36e34ad, type: 2}
inHoleVariable: {fileID: 11400000, guid: 3b0e06d0a76bceb4296c54d02f0d34a4, type: 2}
baseForce: 200
baseForce: 400
hitSoundSource: {fileID: 1555587377596854050}
--- !u!114 &3220627860812539771
MonoBehaviour:
m_ObjectHideFlags: 0
@ -199,3 +201,99 @@ MonoBehaviour:
_tags:
- {fileID: 11400000, guid: 1f557d488f8464000b778362139a0045, type: 2}
- {fileID: 0}
--- !u!82 &1555587377596854050
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 550417892748896529}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: b76a30d1b47d7094aac2c87dbbe93da2, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View File

@ -15,7 +15,7 @@ namespace MAVRIC.GEEKCup
[SerializeField] private UnityEvent<bool> onTrigger;
[SerializeField] private LayerMask layerMask = 1 >> 0;
[SerializeField] private List<StringConstant> tagsMask = new ();
[SerializeField] private List<StringConstant> tagsMask = new List<StringConstant>();
private void OnTriggerEnter(Collider other)
{

8
Assets/Sounds.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 971eae2805eb624438c84cf77a3ebfab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Sounds/downer_noise.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 454f6ff3e51d5fd44ab84bb27b326036
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 8db469e270c7311428e074fc0d1000c1
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Sounds/mixkit-powerful-golf-shot-2126.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: b76a30d1b47d7094aac2c87dbbe93da2
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant: