diff --git a/Assets/Prefabs/Audio/Boost Sound 1.prefab b/Assets/Prefabs/Audio/Boost Sound 1.prefab
index f909a49..71666b6 100644
--- a/Assets/Prefabs/Audio/Boost Sound 1.prefab
+++ b/Assets/Prefabs/Audio/Boost Sound 1.prefab
@@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 6423719894035945655}
- component: {fileID: 3310727599597512245}
- component: {fileID: 7696877450501702533}
+ - component: {fileID: 6827936618995316794}
m_Layer: 0
m_Name: Boost Sound 1
m_TagString: Untagged
@@ -61,7 +62,7 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: d6edf602b3baa0741bd59cce098f05d5, type: 3}
m_PlayOnAwake: 0
- m_Volume: 0.09
+ m_Volume: 0.07
m_Pitch: 0.9
Loop: 0
Mute: 0
@@ -145,3 +146,28 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
+--- !u!169 &6827936618995316794
+AudioLowPassFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_LowpassResonanceQ: 1
+ lowpassLevelCustomCurve:
+ serializedVersion: 2
+ m_Curve:
+ - serializedVersion: 3
+ time: 0
+ value: 0.06775807
+ inSlope: 0
+ outSlope: 0
+ tangentMode: 0
+ weightedMode: 0
+ inWeight: 0.33333334
+ outWeight: 0.33333334
+ m_PreInfinity: 2
+ m_PostInfinity: 2
+ m_RotationOrder: 4
diff --git a/Assets/Prefabs/Audio/Critical Tackle 1.prefab b/Assets/Prefabs/Audio/Critical Tackle 1.prefab
index 5a5a244..f95caaa 100644
--- a/Assets/Prefabs/Audio/Critical Tackle 1.prefab
+++ b/Assets/Prefabs/Audio/Critical Tackle 1.prefab
@@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 6423719894035945655}
- component: {fileID: 3310727599597512245}
- component: {fileID: 7696877450501702533}
+ - component: {fileID: 4941378086240168845}
m_Layer: 0
m_Name: Critical Tackle 1
m_TagString: Untagged
@@ -62,7 +63,7 @@ AudioSource:
m_audioClip: {fileID: 8300000, guid: 029b2e37eed317c49841bf21a7a69233, type: 3}
m_PlayOnAwake: 0
m_Volume: 0.2
- m_Pitch: 1
+ m_Pitch: 1.2
Loop: 0
Mute: 0
Spatialize: 0
@@ -145,3 +146,28 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
+--- !u!169 &4941378086240168845
+AudioLowPassFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ m_Enabled: 0
+ serializedVersion: 3
+ m_LowpassResonanceQ: 1
+ lowpassLevelCustomCurve:
+ serializedVersion: 2
+ m_Curve:
+ - serializedVersion: 3
+ time: 0
+ value: 0.13597089
+ inSlope: 0
+ outSlope: 0
+ tangentMode: 0
+ weightedMode: 0
+ inWeight: 0.33333334
+ outWeight: 0.33333334
+ m_PreInfinity: 2
+ m_PostInfinity: 2
+ m_RotationOrder: 4
diff --git a/Assets/Prefabs/Audio/Main Menu Music.prefab b/Assets/Prefabs/Audio/Main Menu Music.prefab
index ac6d817..a11e429 100644
--- a/Assets/Prefabs/Audio/Main Menu Music.prefab
+++ b/Assets/Prefabs/Audio/Main Menu Music.prefab
@@ -47,6 +47,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
id: 1
audioTag: main_menu_music
+ pitchRange: 0.3
+ volumeRange: 0.3
--- !u!82 &7696877450501702533
AudioSource:
m_ObjectHideFlags: 0
@@ -60,7 +62,7 @@ AudioSource:
m_audioClip: {fileID: 8300000, guid: f03afcd094e19824e8549f6fec3655ef, type: 3}
m_PlayOnAwake: 0
m_Volume: 0.092
- m_Pitch: 0.95
+ m_Pitch: 1.13
Loop: 0
Mute: 0
Spatialize: 0
diff --git a/Assets/Prefabs/Audio/Normal Tackle 1.prefab b/Assets/Prefabs/Audio/Normal Tackle 1.prefab
index 40139a6..0f64ae9 100644
--- a/Assets/Prefabs/Audio/Normal Tackle 1.prefab
+++ b/Assets/Prefabs/Audio/Normal Tackle 1.prefab
@@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 6423719894035945655}
- component: {fileID: 3310727599597512245}
- component: {fileID: 7696877450501702533}
+ - component: {fileID: 6298175476027011211}
m_Layer: 0
m_Name: Normal Tackle 1
m_TagString: Untagged
@@ -145,3 +146,28 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
+--- !u!169 &6298175476027011211
+AudioLowPassFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ m_Enabled: 0
+ serializedVersion: 3
+ m_LowpassResonanceQ: 1
+ lowpassLevelCustomCurve:
+ serializedVersion: 2
+ m_Curve:
+ - serializedVersion: 3
+ time: 0
+ value: 0.13597089
+ inSlope: 0
+ outSlope: 0
+ tangentMode: 0
+ weightedMode: 0
+ inWeight: 0.33333334
+ outWeight: 0.33333334
+ m_PreInfinity: 2
+ m_PostInfinity: 2
+ m_RotationOrder: 4
diff --git a/Assets/Prefabs/Audio/Thruster Sound 1.prefab b/Assets/Prefabs/Audio/Thruster Sound 1.prefab
index 38a8de5..9494e1b 100644
--- a/Assets/Prefabs/Audio/Thruster Sound 1.prefab
+++ b/Assets/Prefabs/Audio/Thruster Sound 1.prefab
@@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 6423719894035945655}
- component: {fileID: 3310727599597512245}
- component: {fileID: 7696877450501702533}
+ - component: {fileID: 7797534259601864668}
m_Layer: 0
m_Name: Thruster Sound 1
m_TagString: Untagged
@@ -47,7 +48,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
id: 1
audioTag: thruster
- pitchRange: 0.4
+ pitchRange: 0.5
volumeRange: 0.3
--- !u!82 &7696877450501702533
AudioSource:
@@ -63,7 +64,7 @@ AudioSource:
m_PlayOnAwake: 0
m_Volume: 0.08
m_Pitch: 1
- Loop: 0
+ Loop: 1
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
@@ -145,3 +146,28 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
+--- !u!169 &7797534259601864668
+AudioLowPassFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ m_Enabled: 0
+ serializedVersion: 3
+ m_LowpassResonanceQ: 1
+ lowpassLevelCustomCurve:
+ serializedVersion: 2
+ m_Curve:
+ - serializedVersion: 3
+ time: 0
+ value: 0.045020465
+ inSlope: 0
+ outSlope: 0
+ tangentMode: 0
+ weightedMode: 0
+ inWeight: 0.33333334
+ outWeight: 0.33333334
+ m_PreInfinity: 2
+ m_PostInfinity: 2
+ m_RotationOrder: 4
diff --git a/Assets/Prefabs/Audio/Zone Change In.prefab b/Assets/Prefabs/Audio/Zone Change In.prefab
new file mode 100644
index 0000000..6ea68d6
--- /dev/null
+++ b/Assets/Prefabs/Audio/Zone Change In.prefab
@@ -0,0 +1,147 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &4479628772504131522
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 6423719894035945655}
+ - component: {fileID: 3310727599597512245}
+ - component: {fileID: 7696877450501702533}
+ m_Layer: 0
+ m_Name: Zone Change In
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &6423719894035945655
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ 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: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &3310727599597512245
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 887650ff1f3850a43aa8d1281fc70528, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ id: 1
+ audioTag: thruster
+ pitchRange: 0.4
+ volumeRange: 0.3
+--- !u!82 &7696877450501702533
+AudioSource:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ m_Enabled: 1
+ serializedVersion: 4
+ OutputAudioMixerGroup: {fileID: 0}
+ m_audioClip: {fileID: 8300000, guid: 025361f5b3f97a445ad89bc9ac61c30b, type: 3}
+ m_PlayOnAwake: 0
+ m_Volume: 0.08
+ m_Pitch: 1
+ Loop: 0
+ Mute: 0
+ Spatialize: 0
+ SpatializePostEffects: 0
+ Priority: 128
+ DopplerLevel: 0
+ MinDistance: 1
+ MaxDistance: 100
+ Pan2D: 0
+ rolloffMode: 1
+ 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: 1
+ 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: 0
+ inSlope: 0
+ outSlope: 0
+ tangentMode: 0
+ weightedMode: 0
+ inWeight: 0.33333334
+ outWeight: 0.33333334
+ m_PreInfinity: 2
+ m_PostInfinity: 2
+ m_RotationOrder: 4
diff --git a/Assets/Prefabs/Audio/Zone Change In.prefab.meta b/Assets/Prefabs/Audio/Zone Change In.prefab.meta
new file mode 100644
index 0000000..46aa031
--- /dev/null
+++ b/Assets/Prefabs/Audio/Zone Change In.prefab.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 28db476bf8ba56c4bacea4ad2070bcad
+PrefabImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Prefabs/Audio/Zone Change Out.prefab b/Assets/Prefabs/Audio/Zone Change Out.prefab
new file mode 100644
index 0000000..b66ec0b
--- /dev/null
+++ b/Assets/Prefabs/Audio/Zone Change Out.prefab
@@ -0,0 +1,147 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &4479628772504131522
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 6423719894035945655}
+ - component: {fileID: 3310727599597512245}
+ - component: {fileID: 7696877450501702533}
+ m_Layer: 0
+ m_Name: Zone Change Out
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &6423719894035945655
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ 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: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &3310727599597512245
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 887650ff1f3850a43aa8d1281fc70528, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ id: 1
+ audioTag: thruster
+ pitchRange: 0.4
+ volumeRange: 0.3
+--- !u!82 &7696877450501702533
+AudioSource:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4479628772504131522}
+ m_Enabled: 1
+ serializedVersion: 4
+ OutputAudioMixerGroup: {fileID: 0}
+ m_audioClip: {fileID: 8300000, guid: 025361f5b3f97a445ad89bc9ac61c30b, type: 3}
+ m_PlayOnAwake: 0
+ m_Volume: 0.08
+ m_Pitch: 1
+ Loop: 0
+ Mute: 0
+ Spatialize: 0
+ SpatializePostEffects: 0
+ Priority: 128
+ DopplerLevel: 0
+ MinDistance: 1
+ MaxDistance: 100
+ Pan2D: 0
+ rolloffMode: 1
+ 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: 1
+ 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: 0
+ inSlope: 0
+ outSlope: 0
+ tangentMode: 0
+ weightedMode: 0
+ inWeight: 0.33333334
+ outWeight: 0.33333334
+ m_PreInfinity: 2
+ m_PostInfinity: 2
+ m_RotationOrder: 4
diff --git a/Assets/Prefabs/Audio/Zone Change Out.prefab.meta b/Assets/Prefabs/Audio/Zone Change Out.prefab.meta
new file mode 100644
index 0000000..2dbb409
--- /dev/null
+++ b/Assets/Prefabs/Audio/Zone Change Out.prefab.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: f35afa6dbb3e6d346a9fa1d98032d910
+PrefabImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/ManageableAudio.cs b/Assets/Scripts/ManageableAudio.cs
index dc0cdcf..0dafc7e 100644
--- a/Assets/Scripts/ManageableAudio.cs
+++ b/Assets/Scripts/ManageableAudio.cs
@@ -1,12 +1,19 @@
+using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using log4net;
+using Managers;
using PrimeTween;
using Unity.VisualScripting;
using UnityEngine;
+public enum AudioEffects
+{
+ LowPass
+}
+
public class ManageableAudio : MonoBehaviour
{
private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -39,6 +46,11 @@ public class ManageableAudio : MonoBehaviour
}
}
+ void Start()
+ {
+ AudioManager.G.AudioEffectBroadcasted += SwitchAudioEffect;
+ }
+
///
/// Start playing the sound source.
///
@@ -131,4 +143,31 @@ public class ManageableAudio : MonoBehaviour
WasOneShotTriggered = false;
}
}
+
+ public void SwitchAudioEffect(AudioEffectBroadCastEventArgs args)
+ {
+ if (args.AffectedParent != transform.parent)
+ {
+ return;
+ }
+ switch (args.Effect)
+ {
+ case AudioEffects.LowPass:
+ SwitchLowPassFilter(args.Activate);
+ break;
+ }
+ }
+
+ public void SwitchLowPassFilter(bool activate)
+ {
+ if (TryGetComponent(out AudioLowPassFilter filter))
+ {
+ filter.enabled = activate;
+ }
+ }
+
+ void OnDestroy()
+ {
+ AudioManager.G.AudioEffectBroadcasted -= SwitchAudioEffect;
+ }
}
diff --git a/Assets/Scripts/Managers/AudioManager.cs b/Assets/Scripts/Managers/AudioManager.cs
index 32eaa39..7cf746f 100644
--- a/Assets/Scripts/Managers/AudioManager.cs
+++ b/Assets/Scripts/Managers/AudioManager.cs
@@ -21,6 +21,9 @@ namespace Managers
private Dictionary audioDictionary =
new Dictionary();
+ public delegate void OnAudioEffectBroadcast(AudioEffectBroadCastEventArgs args);
+ public event OnAudioEffectBroadcast AudioEffectBroadcasted;
+
// Start is called before the first frame update
void Awake()
{
@@ -197,6 +200,22 @@ namespace Managers
}
+ public void BroadcastAudioEffect(AudioEffects effect, Transform t, bool activate)
+ {
+ AudioEffectBroadcasted.Invoke(new AudioEffectBroadCastEventArgs
+ {
+ AffectedParent = t,
+ Effect = effect,
+ Activate = activate
+ });
+ }
+
+ }
+ public class AudioEffectBroadCastEventArgs : EventArgs
+ {
+ public Transform AffectedParent { get; set; }
+ public AudioEffects Effect { get; set; }
+ public bool Activate { get; set; }
}
}
\ No newline at end of file
diff --git a/Assets/Scripts/Managers/MatchManager.cs b/Assets/Scripts/Managers/MatchManager.cs
index 3441a86..ebed24f 100644
--- a/Assets/Scripts/Managers/MatchManager.cs
+++ b/Assets/Scripts/Managers/MatchManager.cs
@@ -9,6 +9,40 @@ using UnityEngine;
using GameLogic;
using System.Threading.Tasks;
+///
+/// States the match can be in.
+///
+public enum MatchState
+{
+ CharacterSelect,
+ Pause,
+ Starting,
+ Match,
+ End
+}
+
+///
+/// Update data relevant to this matches rules.
+///
+public class MatchConditionUpdate
+{
+ public WinCondition Condition { get; set; }
+ public Ship Ship { get; set; }
+ public int Count { get; set; }
+}
+
+///
+/// The properties a player is assigned at the start
+/// of the match, according to the rules.
+///
+public class MatchPlayerStatistic
+{
+ public bool IsOut { get; set; }
+ public int Lives { get; set; }
+ public int Score { get; set; }
+ public int Time { get; set; }
+}
+
namespace Managers
{
///
@@ -79,24 +113,24 @@ namespace Managers
Player updatedPlayer = null;
foreach (Player p in matchPlayers)
{
- if (p.character.shipName == update.ship.props.shipName)
+ if (p.character.shipName == update.Ship.props.shipName)
{
updatedPlayer = p;
Log.Debug($"Players: {p.name} match statistic will be updated.");
}
}
// TODO: Match Result should contain progression over multiple rounds.
- MatchResult mr = MatchLogic.UpdateMatchResult(updatedPlayer, update, matchPlayerStatistics);
- if (updatedPlayer != null && mr != null)
+ MatchResult result = MatchLogic.UpdateMatchResult(updatedPlayer, update, matchPlayerStatistics);
+ if (updatedPlayer != null && result != null)
{
matchState = MatchState.End;
Log.Info("Match has ended, winner will be declared.");
// TODO: Take player decisions into account before restarting the match
// TODO: Include the statistics and match round progression in announcements
- AnnounceWinner(mr);
+ AnnounceWinner(result);
return;
}
- Log.Error($"Ship: {update.ship.props.shipName} does not belong to a player in this match."
+ Log.Error($"Ship: {update.Ship.props.shipName} does not belong to a player in this match."
+ " Can't update match.");
}
@@ -327,37 +361,3 @@ namespace Managers
}
}
-
-///
-/// States the match can be in.
-///
-public enum MatchState
-{
- CharacterSelect,
- Pause,
- Starting,
- Match,
- End
-}
-
-///
-/// Update data relevant to this matches rules.
-///
-public class MatchConditionUpdate
-{
- public WinCondition Condition { get; set; }
- public Ship ship { get; set; }
- public int count { get; set; }
-}
-
-///
-/// The properties a player is assigned at the start
-/// of the match, according to the rules.
-///
-public class MatchPlayerStatistic
-{
- public bool IsOut { get; set; }
- public int Lives { get; set; }
- public int Score { get; set; }
- public int Time { get; set; }
-}
\ No newline at end of file
diff --git a/Assets/Scripts/MatchLogic.cs b/Assets/Scripts/MatchLogic.cs
index b7bdeff..2c56012 100644
--- a/Assets/Scripts/MatchLogic.cs
+++ b/Assets/Scripts/MatchLogic.cs
@@ -24,13 +24,13 @@ namespace GameLogic
switch (args.Condition)
{
case WinCondition.Lives:
- UpdateLives(mps[p], args.count);
+ UpdateLives(mps[p], args.Count);
break;
case WinCondition.Score:
- UpdateScore(mps[p], args.count);
+ UpdateScore(mps[p], args.Count);
break;
case WinCondition.Time:
- UpdateTime(mps[p], args.count);
+ UpdateTime(mps[p], args.Count);
break;
}
return DetectMatchResult(mps);
diff --git a/Assets/Scripts/PlayingFieldDetection.cs b/Assets/Scripts/PlayingFieldDetection.cs
index b88e32b..9a14bd4 100644
--- a/Assets/Scripts/PlayingFieldDetection.cs
+++ b/Assets/Scripts/PlayingFieldDetection.cs
@@ -13,9 +13,11 @@ public class PlayingFieldDetection : MonoBehaviour
///
private void OnTriggerExit(Collider collider)
{
+ // TODO: This depends on a collider leaving the field which has only one
+ // instance with the same tag on the ship object.
if (collider.tag == "Ship")
{
- if (!collider.TryGetComponent(out Ship ship))
+ if (!collider.TryGetComponent(out Ship shipComponent))
{
Log.Error($"Collider: {collider} was tagged as Ship, but has no Ship component.");
return;
@@ -23,8 +25,8 @@ public class PlayingFieldDetection : MonoBehaviour
MatchManager.G.UpdateMatchCondition(new MatchConditionUpdate
{
Condition = WinCondition.Lives,
- ship = ship,
- count = -1
+ Ship = shipComponent,
+ Count = -1
});
}
}
diff --git a/Assets/Scripts/Ship.cs b/Assets/Scripts/Ship.cs
index bc03926..528bec0 100644
--- a/Assets/Scripts/Ship.cs
+++ b/Assets/Scripts/Ship.cs
@@ -26,10 +26,13 @@ public class Ship : MonoBehaviour
private float tackledTime = 0f;
// Current Zone the player occupies
private Zone zone = Zone.NimbleZone;
+ // Upcoming zone change
+ private Zone newZone = Zone.NimbleZone;
private ManageableAudio ThrusterSound;
private ManageableAudio BoosterSound;
- private ManageableAudio ZoneChangeSound;
+ private ManageableAudio LeaveZoneSound;
+ private ManageableAudio EnterZoneSound;
private ManageableAudio TackleOpponentSound;
private ManageableAudio CriticalTackleOpponentSound;
private ManageableAudio BeingTackledSound;
@@ -48,7 +51,8 @@ public class Ship : MonoBehaviour
BoosterSound = AudioManager.G.GetLocalSound("booster", 1, gameObject.transform);
BeingTackledSound = AudioManager.G.GetLocalSound("normal_tackle", 1, gameObject.transform);
BeingCriticallyTackledSound = AudioManager.G.GetLocalSound("critical_tackle", 1, gameObject.transform);
- //ZoneChangeSound = AudioManager.G.GetLocalSound("thruster_sound", 1, gameObject.transform);
+ LeaveZoneSound = AudioManager.G.GetLocalSound("thruster_sound", 1, gameObject.transform);
+ EnterZoneSound = AudioManager.G.GetLocalSound("thruster_sound", 1, gameObject.transform);
}
// Start is called before the first frame update
@@ -94,12 +98,16 @@ public class Ship : MonoBehaviour
}
body.constraints = RigidbodyConstraints.None;
// TODO: This belongs in the state object
- zone = forceManager.GetZoneOfInstance(InstanceID);
+ newZone = forceManager.GetZoneOfInstance(InstanceID);
//BoostStateUpdate(Time.deltaTime);
// Rotate the vehicle with the current steer velocity
// Calculate the magnitude of the acceleration with the current thrust
- UpdateMovement();
UpdateSounds();
+ if (zone != newZone)
+ {
+ zone = newZone;
+ }
+ UpdateMovement();
BoostStateUpdate(Time.deltaTime);
UpdateTackleResponse(isCriticalTackle);
}
@@ -372,6 +380,19 @@ public class Ship : MonoBehaviour
BeingCriticallyTackledSound.ResetOneShot();
BeingTackledSound.ResetOneShot();
}
+ if (newZone != zone)
+ {
+ if (newZone != Zone.NimbleZone)
+ {
+ //LeaveZoneSound?.PlayAudio(false);
+ AudioManager.G.BroadcastAudioEffect(AudioEffects.LowPass, transform, true);
+ }
+ else
+ {
+ //EnterZoneSound?.PlayAudio(false);
+ AudioManager.G.BroadcastAudioEffect(AudioEffects.LowPass, transform, false);
+ }
+ }
}
}