positional sounds pass

This commit is contained in:
cyndrdev 2021-05-17 14:31:13 +01:00
parent 2e774860a3
commit 69c98e9a8d
8 changed files with 77 additions and 34 deletions

View File

@ -26,8 +26,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2832368838255871049}
m_LocalRotation: {x: 0.2294522, y: 0.04979975, z: -0.011756138, w: 0.9719741}
m_LocalPosition: {x: -0.039340973, y: 0.2522471, z: -2.719612}
m_LocalRotation: {x: -0.0981706, y: -0.8403349, z: -0.5077412, w: 0.16247682}
m_LocalPosition: {x: 0.06260109, y: -1.2571502, z: 0.0135195255}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5661344206969957946}
@ -168,6 +168,7 @@ GameObject:
- component: {fileID: 5661344207112327337}
- component: {fileID: 5661344207112327338}
- component: {fileID: 8137033370021049976}
- component: {fileID: 8846952043387883595}
m_Layer: 0
m_Name: Main_Camera
m_TagString: MainCamera
@ -182,8 +183,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5661344207112327339}
m_LocalRotation: {x: 0.2294522, y: 0.04979975, z: -0.011756138, w: 0.9719741}
m_LocalPosition: {x: -0.039340973, y: 0.2522471, z: -2.719612}
m_LocalRotation: {x: -0.0981706, y: -0.8403349, z: -0.5077412, w: 0.16247682}
m_LocalPosition: {x: 0.06260109, y: -1.2571502, z: 0.0135195255}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5661344206969957946}
@ -214,7 +215,7 @@ Camera:
height: 1
near clip plane: 0.1
far clip plane: 5000
field of view: 50
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
@ -318,6 +319,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9d54716c6690d97469638748463784b8, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8846952043387883595
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5661344207112327339}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 86c6556701af9e04380698b89f691b6e, type: 3}
m_Name:
m_EditorClassIdentifier:
attenuationObject: {fileID: 0}
ListenerNumber: -1
--- !u!1 &5661344207311831626
GameObject:
m_ObjectHideFlags: 0
@ -378,7 +393,7 @@ MonoBehaviour:
m_LookAt: {fileID: 0}
m_Follow: {fileID: 0}
m_Lens:
FieldOfView: 50
FieldOfView: 60
OrthographicSize: 10
NearClipPlane: 0.1
FarClipPlane: 5000
@ -452,7 +467,7 @@ MonoBehaviour:
m_LookAt: {fileID: 0}
m_Follow: {fileID: 0}
m_Lens:
FieldOfView: 50
FieldOfView: 60
OrthographicSize: 10
NearClipPlane: 0.1
FarClipPlane: 5000
@ -524,7 +539,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_FollowOffset: {x: 0, y: 1, z: -2}
m_FollowOffset: {x: 0, y: 0.5, z: -0.8}
m_XDamping: 0.1
m_YDamping: 0.1
m_ZDamping: 0.1
@ -534,7 +549,7 @@ MonoBehaviour:
m_RollDamping: 0
m_AngularDamping: 0
m_Heading:
m_Definition: 2
m_Definition: 1
m_VelocityFilterStrength: 4
m_Bias: 0
m_RecenterToTargetHeading:
@ -650,7 +665,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_FollowOffset: {x: 0, y: 1, z: -2}
m_FollowOffset: {x: 0, y: 0.5, z: -0.8}
m_XDamping: 0.25
m_YDamping: 0.5
m_ZDamping: 0.25
@ -660,7 +675,7 @@ MonoBehaviour:
m_RollDamping: 0
m_AngularDamping: 0
m_Heading:
m_Definition: 2
m_Definition: 1
m_VelocityFilterStrength: 4
m_Bias: 0
m_RecenterToTargetHeading:
@ -747,8 +762,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5661344207789115490}
m_LocalRotation: {x: 0.22945215, y: 0.04979975, z: -0.011756136, w: 0.9719741}
m_LocalPosition: {x: 0.4574869, y: -0.86750305, z: -1.2498176}
m_LocalRotation: {x: 0.0981706, y: 0.8403349, z: 0.5077412, w: -0.16247682}
m_LocalPosition: {x: 0.06260109, y: -1.2571502, z: 0.0135195255}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5661344207439169721}
@ -1033,7 +1048,7 @@ MonoBehaviour:
m_LookAt: {fileID: 0}
m_Follow: {fileID: 0}
m_Lens:
FieldOfView: 50
FieldOfView: 60
OrthographicSize: 10
NearClipPlane: 0.1
FarClipPlane: 5000
@ -1105,7 +1120,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_BindingMode: 4
m_FollowOffset: {x: 0, y: 1, z: -2}
m_FollowOffset: {x: 0, y: 0.5, z: -0.8}
m_XDamping: 0.5
m_YDamping: 0.5
m_ZDamping: 0.5
@ -1115,7 +1130,7 @@ MonoBehaviour:
m_RollDamping: 0
m_AngularDamping: 0
m_Heading:
m_Definition: 2
m_Definition: 1
m_VelocityFilterStrength: 4
m_Bias: 0
m_RecenterToTargetHeading:

View File

@ -118,11 +118,11 @@ public partial class DialogueSystem : ScriptableObject
public float GetLineDuration(string key) => _settings.GetDialogueClip(key).length;
public void PlayLineBaz(string key) => PlayLine(ref _bazInstance, _settings.BazDialogueKey, key);
public void PlayLineBaz(string key, Transform bazObject) => PlayLine(ref _bazInstance, _settings.BazDialogueKey, key, speakerObject: bazObject);
public void PlayLineRadio(string key) => PlayLine(ref _radioInstance, _settings.RadioDialogueKey, key);
// noRepeat locks this key off from further use. further attempts to use the key will be discarded
private void PlayLine(ref EventInstance eventInstance, string speakerKey, string key, bool noRepeat = true)
private void PlayLine(ref EventInstance eventInstance, string speakerKey, string key, bool noRepeat = true, Transform speakerObject = null )
{
if (noRepeat)
{
@ -152,6 +152,10 @@ public partial class DialogueSystem : ScriptableObject
dl.duration = clip.length;
eventInstance.setCallback(_dialogueCallback);
if ( speakerObject )
{
RuntimeManager.AttachInstanceToGameObject( eventInstance, speakerObject, (Rigidbody) null );
}
eventInstance.start();
onDialogueLine?.Invoke(this, dl);

View File

@ -17,6 +17,7 @@ public class ScriptedDialogueTrigger : MonoBehaviour
[SerializeField] private DialogueSystem _dialogue;
[SerializeField] private Speaker _speaker = Speaker.Radio;
[SerializeField] private Transform _speakerTransform;
[Obsolete]
[SerializeField] private string _key;
@ -54,7 +55,7 @@ public class ScriptedDialogueTrigger : MonoBehaviour
if (_keys.Length == 0)
{
PlayLine(_key);
PlayLine(_key, _speakerTransform);
}
else
{
@ -68,7 +69,7 @@ public class ScriptedDialogueTrigger : MonoBehaviour
var elapsed = 0f;
// play first line
PlayLine(_keys[0]);
PlayLine(_keys[0], _speakerTransform);
while (idx < _keys.Length)
{
@ -77,14 +78,14 @@ public class ScriptedDialogueTrigger : MonoBehaviour
{
elapsed = 0;
idx++;
PlayLine(_keys[idx]);
PlayLine(_keys[idx], _speakerTransform);
}
yield return null;
}
}
private void PlayLine(string key)
private void PlayLine(string key, Transform speakerObject)
{
switch (_speaker)
{
@ -93,7 +94,7 @@ public class ScriptedDialogueTrigger : MonoBehaviour
break;
case Speaker.Baz:
_dialogue.PlayLineBaz(key);
_dialogue.PlayLineBaz(key, speakerObject);
break;
}
}

View File

@ -3,8 +3,11 @@ using UnityEngine;
using NaughtyAttributes;
using Ktyl.Util;
using System.Collections;
using FMOD;
using FMOD.Studio;
using FMODUnity;
using UnityEngine.UI;
using STOP_MODE = FMOD.Studio.STOP_MODE;
public class PlayerController : MonoBehaviour
{
@ -96,14 +99,17 @@ public class PlayerController : MonoBehaviour
[SerializeField]
[FMODUnity.EventRef]
private string _freezeSfx;
private EventInstance _freezeInstance;
[SerializeField]
[FMODUnity.EventRef]
private string _blinkSfx;
private EventInstance _blinkInstance;
[SerializeField]
[FMODUnity.EventRef]
private string _boostSfx;
private EventInstance _boostInstance;
private enum JumpState
{
@ -120,6 +126,17 @@ public class PlayerController : MonoBehaviour
private void Start()
{
_freezeVfx.SetActive( false );
_freezeInstance = RuntimeManager.CreateInstance( _freezeSfx );
_blinkInstance = RuntimeManager.CreateInstance( _blinkSfx );
_boostInstance = RuntimeManager.CreateInstance( _boostSfx );
}
private void PlayPlayerSFX( EventInstance instance )
{
instance.stop(STOP_MODE.IMMEDIATE);
instance.start();
RuntimeManager.AttachInstanceToGameObject( instance, transform, (Rigidbody)null );
}
private Color GetDebugColor()
@ -184,7 +201,7 @@ public class PlayerController : MonoBehaviour
Vector2 blinkDirection = Vector2.up.Rotate( -_lookAngle );
_overrideDelta += blinkDirection * _movementSettings.BlinkDistance;
_surfVelocity += blinkDirection * _movementSettings.BlinkVelocity;
FMODUnity.RuntimeManager.PlayOneShot( _blinkSfx );
PlayPlayerSFX( _blinkInstance );
}
}
@ -196,7 +213,7 @@ public class PlayerController : MonoBehaviour
_powers.Freeze.Consume();
objectTimeScale.Value = 0f;
_freezeVfx.SetActive( true );
FMODUnity.RuntimeManager.PlayOneShot( _freezeSfx );
PlayPlayerSFX( _freezeInstance );
}
if ( _powers.Freeze.timeSinceConsume > frozenTime && TimeIsFrozen )
@ -259,7 +276,7 @@ public class PlayerController : MonoBehaviour
_yVelocity = _movementSettings.MinBoostVelocity;
}
RuntimeManager.PlayOneShot(_boostSfx);
PlayPlayerSFX( _boostInstance );
}
break;

Binary file not shown.

BIN
game/FMOD Project/Build/Desktop/SFX.bank (Stored with Git LFS)

Binary file not shown.

BIN
game/FMOD Project/Build/Desktop/VO.bank (Stored with Git LFS)

Binary file not shown.

View File

@ -26,7 +26,7 @@ https://soundcloud.com/nasa</value>
<value>Baz Dialogue Line</value>
</property>
<property name="outputFormat">
<value>1</value>
<value>2</value>
</property>
<relationship name="folder">
<destination>{aacc9c7d-10bf-4006-bcdd-9a56dd0d03e4}</destination>
@ -157,6 +157,7 @@ https://soundcloud.com/nasa</value>
<destination>{1d02e252-40d7-45a2-918e-171d67ad50a3}</destination>
<destination>{aa3974fd-9122-4ef6-91bd-d1cbbd5d9c18}</destination>
<destination>{2cf8ef76-9df1-4b8a-905e-279aeec02cd2}</destination>
<destination>{0d1e768d-81c4-439c-8703-536561e3a8d4}</destination>
</relationship>
</object>
<object class="MixerBusPanner" id="{1a5b9e49-1b29-4c35-a757-9d8a760ffb14}" />
@ -189,6 +190,11 @@ https://soundcloud.com/nasa</value>
</property>
</object>
<object class="MixerBusFader" id="{2cf8ef76-9df1-4b8a-905e-279aeec02cd2}" />
<object class="SpatialiserEffect" id="{0d1e768d-81c4-439c-8703-536561e3a8d4}">
<property name="minimumDistance">
<value>3.4000001</value>
</property>
</object>
<object class="ThreeEQEffect" id="{3f4f241b-4126-48a1-9fe1-1f3b222aaf7a}">
<property name="bypass">
<value>true</value>