Добавлен тестовый голос.

This commit is contained in:
DyatelO 2021-11-30 08:36:07 +03:00
parent 5e0988f085
commit efaa88be62
12 changed files with 611 additions and 102 deletions

208
Assets/NewAudioMixer.mixer Normal file
View File

@ -0,0 +1,208 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!243 &-6502101523354408336
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Effects
m_AudioMixer: {fileID: 24100000}
m_GroupID: 614a3220fd2a0d14fbfad6e57ab18a66
m_Children: []
m_Volume: fe4a74449a336de448adedd47e8816ad
m_Pitch: 2b6963edc66f3ad49828b888d228878f
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: 5879465684049354889}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!243 &-6241634536419500954
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Voices
m_AudioMixer: {fileID: 24100000}
m_GroupID: 606513e081c510349a324c0e62c3c85b
m_Children: []
m_Volume: 940ba12b11d013c4b8346efb780128b3
m_Pitch: ef600f3206161dc49b2fdf5ea925d0cd
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: 3508071888153222627}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!243 &-4528150207959417603
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Buttons
m_AudioMixer: {fileID: 24100000}
m_GroupID: c6d229c57a00933488915ba563eac7b1
m_Children: []
m_Volume: 5dbfc720d6731fa4c9265163a9ed6db5
m_Pitch: e1b8d552218df2a44bf6e38be3ffdcdc
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: -2368135767811344146}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!244 &-2368135767811344146
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: c2e07d5d94645f24fa01dbe7495959b7
m_EffectName: Attenuation
m_MixLevel: 5ba21ccc57a89514eab9f5123631b50a
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!241 &24100000
AudioMixerController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NewAudioMixer
m_OutputGroup: {fileID: 0}
m_MasterGroup: {fileID: 24300002}
m_Snapshots:
- {fileID: 24500006}
m_StartSnapshot: {fileID: 24500006}
m_SuspendThreshold: -80
m_EnableSuspend: 1
m_UpdateMode: 0
m_ExposedParameters: []
m_AudioMixerGroupViews:
- guids:
- edf879b929639e944abe1b76ad30bcbe
- 614a3220fd2a0d14fbfad6e57ab18a66
- c6d229c57a00933488915ba563eac7b1
- cf89a6b93efb9fb4a9657267a0b94ba9
- 606513e081c510349a324c0e62c3c85b
name: View
m_CurrentViewIndex: 0
m_TargetSnapshot: {fileID: 24500006}
--- !u!243 &24300002
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Master
m_AudioMixer: {fileID: 24100000}
m_GroupID: edf879b929639e944abe1b76ad30bcbe
m_Children:
- {fileID: -6502101523354408336}
- {fileID: -4528150207959417603}
- {fileID: 716103186404916002}
- {fileID: -6241634536419500954}
m_Volume: 3715417608654f847af639d074529a89
m_Pitch: 1916fa3c06cb731459a054aeca338059
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: 24400004}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!244 &24400004
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 501723c8b6d021746bd4d895591704dd
m_EffectName: Attenuation
m_MixLevel: 8a8dc38064f6a1c46aafe0c553a5f013
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!245 &24500006
AudioMixerSnapshotController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Snapshot
m_AudioMixer: {fileID: 24100000}
m_SnapshotID: a2d773146b51ad4489c9c47d5d273249
m_FloatValues: {}
m_TransitionOverrides: {}
--- !u!243 &716103186404916002
AudioMixerGroupController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Shoots
m_AudioMixer: {fileID: 24100000}
m_GroupID: cf89a6b93efb9fb4a9657267a0b94ba9
m_Children: []
m_Volume: 5a4ff7a0189b3f24a90fb37d0a5973b4
m_Pitch: ae1a721c3fd6dc24eb9589f605582cb4
m_Send: 00000000000000000000000000000000
m_Effects:
- {fileID: 3134906621760079642}
m_UserColorIndex: 0
m_Mute: 0
m_Solo: 0
m_BypassEffects: 0
--- !u!244 &3134906621760079642
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 62438098b66093c408cd9804eaa91e73
m_EffectName: Attenuation
m_MixLevel: 3ca65912d9ff7f649a4900b41f9ccc18
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!244 &3508071888153222627
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: 9a58437aaf85eeb4198de8285473b509
m_EffectName: Attenuation
m_MixLevel: d8c351788b008c947851c2d868f91714
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0
--- !u!244 &5879465684049354889
AudioMixerEffectController:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_EffectID: c6ebcc391cd596d4b879a0e412a660ef
m_EffectName: Attenuation
m_MixLevel: be2bfe27f4ebac640bf5a29a5b61716d
m_Parameters: []
m_SendTarget: {fileID: 0}
m_EnableWetMix: 0
m_Bypass: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5b71a1e2cfc04854a866ea6c6c092898
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 24100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3032,6 +3032,18 @@ MonoBehaviour:
m_StringArgument: m_StringArgument:
m_BoolArgument: 1 m_BoolArgument: 1
m_CallState: 2 m_CallState: 2
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine
m_MethodName: SetActive
m_Mode: 6
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
--- !u!114 &2272035603379506085 --- !u!114 &2272035603379506085
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3832,7 +3844,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 130.05} m_AnchoredPosition: {x: 0, y: 130.0498}
m_SizeDelta: {x: 0, y: -260.1} m_SizeDelta: {x: 0, y: -260.1}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7117637458024167129 --- !u!222 &7117637458024167129

File diff suppressed because one or more lines are too long

View File

@ -6,15 +6,18 @@ public class Extralife : MonoBehaviour
{ {
public int life = 1; public int life = 1;
[SerializeField] private DeathMenu menu; [SerializeField] private DeathMenu menu;
public static int staticLives;
public int staticNoLife;
private void Awake() {
staticLives = life;
}
/* void Update() void Update()
{ {
if(life == 0) life = staticLives;
{
//Count.lifesValue -= 1; }
menu.LoadMenu();
}
}*/
private void OnTriggerEnter(Collider other) { private void OnTriggerEnter(Collider other) {
if(life < 0) if(life < 0)

View File

@ -27,7 +27,7 @@ public class RewardExtraLife : MonoBehaviour
private void Update() { private void Update() {
if(health.currentHealth <= 0) if(health.currentHealth <= 0)
_extraLife.life = lifeCount - 1; Extralife.staticLives = lifeCount - 1;
} }
private void HandleEarnedReward(object sender, Reward e) private void HandleEarnedReward(object sender, Reward e)
@ -35,7 +35,9 @@ public class RewardExtraLife : MonoBehaviour
//_extraLife.life ; //_extraLife.life ;
//extralife--; //extralife--;
//_extraLife.life--; //_extraLife.life--;
lifeCount -= 1; Extralife.staticLives-- ;
//-= 1;
lifeCount = Extralife.staticLives ;
_extraLife.life = lifeCount ; _extraLife.life = lifeCount ;
} }

View File

@ -7,7 +7,7 @@ using UnityEngine.Audio;
public class AudioSwitcher : MonoBehaviour public class AudioSwitcher : MonoBehaviour
{ {
public Sounds[] sounds; public Sounds[] sounds;
public Sounds[] phrases; //public Sounds[] phrases;
private void Awake() { private void Awake() {
foreach(Sounds s in sounds) foreach(Sounds s in sounds)
@ -18,7 +18,7 @@ public class AudioSwitcher : MonoBehaviour
s.source.volume = s.volume; s.source.volume = s.volume;
s.source.pitch = s.pitch; s.source.pitch = s.pitch;
} }
/*
foreach(Sounds p in phrases) foreach(Sounds p in phrases)
{ {
p.source = gameObject.AddComponent<AudioSource>(); p.source = gameObject.AddComponent<AudioSource>();
@ -26,9 +26,11 @@ public class AudioSwitcher : MonoBehaviour
p.source.volume = p.volume; p.source.volume = p.volume;
p.source.pitch = p.pitch; p.source.pitch = p.pitch;
} }
*/
} }
public void Play(string name) public void Play(string name)
{ {
Sounds s = Array.Find(sounds, sound => sound.nmae == name); Sounds s = Array.Find(sounds, sound => sound.nmae == name);
@ -36,6 +38,7 @@ public class AudioSwitcher : MonoBehaviour
return; return;
s.source.Play(); s.source.Play();
} }
/*
public void PlayPhrase(string name) public void PlayPhrase(string name)
{ {
Sounds s = Array.Find(phrases, sound => sound.nmae == name); Sounds s = Array.Find(phrases, sound => sound.nmae == name);
@ -43,4 +46,5 @@ public class AudioSwitcher : MonoBehaviour
return; return;
s.source.Play(); s.source.Play();
} }
*/
} }

View File

@ -8,47 +8,48 @@ using UnityEngine.Audio;
public class SaySomething : MonoBehaviour public class SaySomething : MonoBehaviour
{ {
//[SerializeField] private List<HealthController> playerHealths; //[SerializeField] private List<HealthController> playerHealths;
[SerializeField] private List<Sounds> prases; //[SerializeField] private List<Sounds> phrases;
[SerializeField] private Extralife life;
//[SerializeField] private GameManager manager;
[SerializeField] private HealthController health; [SerializeField] private HealthController health;
[SerializeField] MainWeapon player;
[SerializeField] private AudioSource playerSource;
[SerializeField] private List<PlayerState> players;
private int startlives;
public static float healthCount;
public static MainWeapon mainWeapon;
void Start() void Start()
{ {
health = FindObjectOfType<HealthController>(); mainWeapon = player;
healthCount = health.currentHealth;
//players = new List<PlayerState>(FindObjectsOfType<PlayerState>());
foreach(Sounds p in prases) //startPlayersCount = players.Count;
{
p.source = gameObject.AddComponent<AudioSource>(); startlives = Extralife.staticLives;
p.source.clip = p.clip;
p.source.volume = p.volume;
p.source.pitch = p.pitch;
}
// playerHealths = new List<HealthController>( FindObjectsOfType<HealthController>());
// //playerHealths.AddRange( );
// foreach(HealthController hc in playerHealths)
// {
// if(hc.currentHealth <= 0)
// {
// //FindObjectOfType<AudioSwitcher>().PlayPhrase(Random.Range(0, 15));
// }
// }
} }
// Update is called once per frame // Update is called once per frame
private void Update() { private void Update() {
if(health.currentHealth <= 0) player = FindObjectOfType<MainWeapon>();
if(player == null)
{ {
Say(); VoiceEnable.isDisable = true;
//playerSource.Play();
} }
else
VoiceEnable.isDisable = false;
} }
public void Say() public void Say()
{ {
if() playerSource.Play();
Debug.Log("Play");
} }
} }

View File

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VoiceEnable : MonoBehaviour
{
public GameObject objectToEnable;
public AudioSource source;
public static bool isDisable;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(isDisable)
objectToEnable.SetActive(true);
else
objectToEnable.SetActive(false);
//source.PlayOneShot(source.clip);
source.playOnAwake = source.clip;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f200256865677349876f0c792db445b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,6 +10,11 @@ public class PlayerTrigger : MonoBehaviour
private void OnTriggerEnter(Collider other) { private void OnTriggerEnter(Collider other) {
if(other.gameObject.GetComponent<ProjectileController>() == null)
{
return;
}
if(other.gameObject.GetComponent<ProjectileController>().damage == 1000) if(other.gameObject.GetComponent<ProjectileController>().damage == 1000)
{ {
FindObjectOfType<AudioSwitcher>().Play("Lighting_Hit"); FindObjectOfType<AudioSwitcher>().Play("Lighting_Hit");

File diff suppressed because one or more lines are too long