2 working sounds, updated scripts, fmod events
This commit is contained in:
@@ -6,6 +6,7 @@ using FishNet.Object.Synchronizing;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
|
||||
public class ArcheryTarget : NetworkBehaviour, IArrowHittable
|
||||
{
|
||||
public GameObject pointsText;
|
||||
@@ -50,6 +51,8 @@ public class ArcheryTarget : NetworkBehaviour, IArrowHittable
|
||||
target.SetPoints(score);
|
||||
Spawn(prefab);
|
||||
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.UFODestroy, gameObject);
|
||||
|
||||
Despawn(arrow.gameObject, DespawnType.Pool);
|
||||
Despawn(gameObject, DespawnType.Pool);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
using FMOD.Studio;
|
||||
|
||||
namespace _PROJECT.Components.Drawing
|
||||
{
|
||||
@@ -18,16 +19,26 @@ namespace _PROJECT.Components.Drawing
|
||||
private float _cooldownTimer = 0f;
|
||||
private bool _isSpraying;
|
||||
|
||||
private EventInstance spray_sound;
|
||||
|
||||
protected override void OnActivated(ActivateEventArgs args)
|
||||
{
|
||||
base.OnActivated(args);
|
||||
StartSpray();
|
||||
|
||||
spray_sound = AudioManager.Instance.CreateInstance(FMODEvents.Instance.Spray);
|
||||
spray_sound.setParameterByName("SpraySwitcher", 0); //"Spray - 0 in FMOD"
|
||||
spray_sound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(sprayPoint));
|
||||
spray_sound.start();
|
||||
}
|
||||
|
||||
protected override void OnDeactivated(DeactivateEventArgs args)
|
||||
{
|
||||
base.OnDeactivated(args);
|
||||
StopSpray();
|
||||
|
||||
spray_sound.setParameterByName("SpraySwitcher", 1); //"NoSpray - 1 in FMOD"
|
||||
spray_sound.release();
|
||||
}
|
||||
|
||||
private new void Awake()
|
||||
@@ -43,21 +54,37 @@ namespace _PROJECT.Components.Drawing
|
||||
_isSpraying = true;
|
||||
trigger.transform.Rotate(0f, 0f, -8.5f);
|
||||
sprayPart.Play(true);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void StopSpray()
|
||||
{
|
||||
|
||||
|
||||
_isSpraying = false;
|
||||
trigger.transform.Rotate(0f, 0f, 8.5f);
|
||||
sprayPart.Stop(true, ParticleSystemStopBehavior.StopEmitting);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_isSpraying)
|
||||
{
|
||||
spray_sound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(sprayPoint));
|
||||
}
|
||||
|
||||
if (!isSelected || !_isSpraying)
|
||||
{
|
||||
if (!sprayPart.isPlaying) return;
|
||||
sprayPart.Stop(true, ParticleSystemStopBehavior.StopEmitting);
|
||||
|
||||
spray_sound.setParameterByName("SpraySwitcher", 1); //"NoSpray - 1 in FMOD"
|
||||
spray_sound.release();
|
||||
|
||||
_isSpraying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4379,6 +4379,7 @@ GameObject:
|
||||
- component: {fileID: 6243020581121736520}
|
||||
- component: {fileID: 1248243081272065818}
|
||||
- component: {fileID: 7904742026328308208}
|
||||
- component: {fileID: 438034309889585932}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
@@ -4615,6 +4616,20 @@ MonoBehaviour:
|
||||
mipBias: 0
|
||||
varianceClampScale: 0.9
|
||||
contrastAdaptiveSharpening: 0
|
||||
--- !u!114 &438034309889585932
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6810398627900972352}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 86c6556701af9e04380698b89f691b6e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
nonRigidbodyVelocity: 0
|
||||
attenuationObject: {fileID: 0}
|
||||
--- !u!1 &6839907377310123617
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -18,7 +18,7 @@ public class SpaceEnterCollider : MonoBehaviour
|
||||
{
|
||||
InstructionText.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
|
||||
//Debug.Log("Instruction text rotation" + InstructionText.transform.rotation);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
InstructionText.transform.rotation = Quaternion.Euler(0f, 0f, -180f);
|
||||
@@ -31,6 +31,7 @@ public class SpaceEnterCollider : MonoBehaviour
|
||||
playerGravity.isInSpace = true;
|
||||
}
|
||||
Debug.Log(other + " entered space.");
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.PortalEnter, gameObject);
|
||||
}
|
||||
|
||||
private void OnTriggerExit(Collider other)
|
||||
@@ -52,5 +53,6 @@ public class SpaceEnterCollider : MonoBehaviour
|
||||
yield return new WaitForSeconds(1f); // Wait for 1 second
|
||||
playerGravity.isInSpace = false;
|
||||
Debug.Log("Default gravity restored after 1 second.");
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.PortalEnter, gameObject);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user