Merge branch 'Dev' into movement-dev
This commit is contained in:
commit
df0c2b3157
199 files changed
+36761
-831
No files matched your search
@@ -256,7 +256,7 @@ namespace Code.App.AppStates
|
||||
{
|
||||
var sceneEnvironment = (GameplaySceneEnvironment)sceneContainer.Resolve<CurrentSceneEnvironment>();
|
||||
|
||||
_debugTube = sceneEnvironment.debugTube;
|
||||
|
||||
return sceneEnvironment;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace Code.App.AppStates
|
||||
{
|
||||
await UniTask.WhenAll(
|
||||
Context.UIService.AsyncSwitchPanelTo(UIPanel.MainMenu),
|
||||
Context.AudioFactory.WarmMenuMusic()
|
||||
Context.AudioFactory.WarmMenuMusic(),
|
||||
Context.AudioFactory.WarmAudioTestClips()
|
||||
);
|
||||
Context.LoadingManager
|
||||
.UnregisterLoading(LoadingWork.LoadUI)
|
||||
@@ -98,6 +99,7 @@ namespace Code.App.AppStates
|
||||
menuPanel.exitButton.button.onClick.AddListener(ExitGame);
|
||||
|
||||
mainMenuEnvironment.menuButtonsCanvas.worldCamera = Context.CameraStateMachine.Camera;
|
||||
mainMenuEnvironment.settingsCanvas.worldCamera = Context.CameraStateMachine.Camera;
|
||||
}
|
||||
|
||||
public override void Tick()
|
||||
@@ -120,6 +122,7 @@ namespace Code.App.AppStates
|
||||
Context.InputService.DisableMap(ActionMappings.MainMenu);
|
||||
Context.AudioService.GladlyAskToStopMusic(MusicType.Menu, callback: Context.AudioFactory.ReleaseMenuMusic);
|
||||
|
||||
Context.AudioFactory.ReleaseAudioTestClips();
|
||||
base.ExitState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using Code.Gameplay.Camera;
|
||||
using Code.Gameplay.Enemies;
|
||||
using Code.Gameplay.Orders.Order;
|
||||
using Code.Gameplay.Player;
|
||||
using Code.Generator;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.StaticData;
|
||||
@@ -32,10 +33,11 @@ namespace Code.App
|
||||
containerBuilder.AddSingleton(typeof(LoadingManager), typeof(ILoadingManager));
|
||||
|
||||
containerBuilder.AddSingleton(typeof(InputService), typeof(IInputService));
|
||||
// Перенести нахуй в контейнер геймплея
|
||||
containerBuilder.AddSingleton(typeof(PlayerFactory), typeof(IPlayerFactory));
|
||||
containerBuilder.AddSingleton(typeof(EnemyFactory), typeof(IEnemyFactory));
|
||||
containerBuilder.AddSingleton(typeof(PlayerProvider), typeof(IPlayerProvider));
|
||||
|
||||
//
|
||||
InitializeCamera(containerBuilder, staticDataService);
|
||||
|
||||
containerBuilder.AddSingleton(typeof(UIFactory), typeof(IUIFactory));
|
||||
@@ -93,6 +95,7 @@ namespace Code.App
|
||||
|
||||
containerBuilder.AddSingleton(staticDataService.AudioMixerConfig, typeof(AudioMixerConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.SoundtrackListConfig, typeof(SoundtrackListConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.AudioTestClipsConfig, typeof(AudioTestClipsConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.SFXListConfig, typeof(SFXListConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.DispatcherSoundListConfig, typeof(DispatcherSoundListConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.EnemiesSoundListConfig, typeof(EnemiesSoundListConfig));
|
||||
@@ -100,6 +103,8 @@ namespace Code.App
|
||||
|
||||
containerBuilder.AddSingleton(staticDataService.OrderServiceConfig, typeof(OrderServiceConfig));
|
||||
containerBuilder.AddSingleton(staticDataService.OrderBoxConfig, typeof(OrderBoxConfig));
|
||||
|
||||
containerBuilder.AddSingleton(staticDataService.GeneratorConfig, typeof(GeneratorConfig));
|
||||
}
|
||||
|
||||
private AppStateMachine _appStateMachine;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Code.App.Loading;
|
||||
using Code.Gameplay.Orders.Order;
|
||||
using Code.Gameplay.Player;
|
||||
using Code.Generator;
|
||||
using Code.Scenes;
|
||||
using Code.Scenes.SceneEnvironments;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Reflex.Core;
|
||||
using UnityEngine;
|
||||
using IPlayerScore = Code.Gameplay.Player.IPlayerScore;
|
||||
@@ -18,6 +20,8 @@ namespace Code.App.SceneInstallers
|
||||
containerBuilder.AddScoped(typeof(GameplaySceneEnvironment), typeof(CurrentSceneEnvironment));
|
||||
containerBuilder.AddScoped(typeof(PlayerScore), typeof(IPlayerScore));
|
||||
containerBuilder.AddScoped(typeof(OrderService), typeof(IOrderService));
|
||||
containerBuilder.AddScoped(typeof(RoomGeneratorFactory), typeof(IRoomGeneratorFactory));
|
||||
containerBuilder.AddScoped(typeof(RoomGenerator));
|
||||
|
||||
containerBuilder.OnContainerBuilt += Initialize;
|
||||
}
|
||||
@@ -32,6 +36,17 @@ namespace Code.App.SceneInstallers
|
||||
|
||||
loadingManager
|
||||
.UnregisterLoading(LoadingWork.LoadScene);
|
||||
|
||||
LoadRooms(container,loadingManager);
|
||||
}
|
||||
|
||||
private async UniTaskVoid LoadRooms(Container container, ILoadingManager loadingManager)
|
||||
{
|
||||
await container.Resolve<IRoomGeneratorFactory>().PreloadRooms(container.Resolve<IOrderService>());
|
||||
|
||||
container.Resolve<RoomGenerator>().Initialize();
|
||||
|
||||
loadingManager.UnregisterLoading(LoadingWork.LoadModelResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using Code.Audio;
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Gameplay.Enemies;
|
||||
using Code.Gameplay.Player;
|
||||
using Code.Generator;
|
||||
using Code.Input;
|
||||
using Code.Scenes;
|
||||
using Code.UI;
|
||||
@@ -22,6 +23,6 @@ namespace Code.App.StateMachine
|
||||
[Inject] public IPlayerProvider PlayerProvider { get; private set; }
|
||||
[Inject] public IAudioFactory AudioFactory { get; private set; }
|
||||
[Inject] public IAudioService AudioService { get; private set; }
|
||||
[Inject] public IEnemyFactory EnemyFactory { get; private set; }
|
||||
[Inject] public IEnemyFactory EnemyFactory { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Code.Configs;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
@@ -15,6 +16,7 @@ namespace Code.Audio
|
||||
public AudioMixer AudioMixer { get; private set; }
|
||||
private AssetReference _audioSourcePrefab;
|
||||
|
||||
private AssetReference[] _audioTestClipsReferences;
|
||||
private AssetReference[] _peacefulSoundtrack;
|
||||
private AssetReference[] _actionSoundtrack;
|
||||
private AssetReference[] _menuSoundtrack;
|
||||
@@ -23,6 +25,7 @@ namespace Code.Audio
|
||||
private AssetReference[] _dispatcher;
|
||||
private AssetReference[] _character;
|
||||
|
||||
private AsyncOperationHandle<IList<AudioClip>> _audioTestClipsHandle;
|
||||
private AsyncOperationHandle<IList<AudioClip>> _menuMusicHandle;
|
||||
private AsyncOperationHandle<IList<AudioClip>> _actionMusicHandle;
|
||||
private AsyncOperationHandle<IList<AudioClip>> _peacefulMusicHandle;
|
||||
@@ -30,6 +33,7 @@ namespace Code.Audio
|
||||
private AsyncOperationHandle<IList<AudioClip>> _enemiesHandle;
|
||||
private AsyncOperationHandle<IList<AudioClip>> _dispatcherHandle;
|
||||
|
||||
public Dictionary<AudioType, AudioClip> AudioTestClips { get; private set; } = new();
|
||||
public Dictionary<MusicType, List<AudioClip>> MusicDictionary { get; private set; } = new();
|
||||
public List<AudioClip> SFXAudios { get; private set; } = new();
|
||||
public List<AudioClip> EnemiesAudios { get; private set; } = new();
|
||||
@@ -39,7 +43,8 @@ namespace Code.Audio
|
||||
SoundtrackListConfig soundtrackListConfig,
|
||||
SFXListConfig sfxListConfig,
|
||||
EnemiesSoundListConfig enemiesSoundListConfig,
|
||||
DispatcherSoundListConfig dispatcherSoundListConfig
|
||||
DispatcherSoundListConfig dispatcherSoundListConfig,
|
||||
AudioTestClipsConfig audioTestClipsConfig
|
||||
)
|
||||
{
|
||||
AudioMixer = audioMixerConfig.audioMixerAsset;
|
||||
@@ -51,6 +56,7 @@ namespace Code.Audio
|
||||
_SFX = sfxListConfig.SFX;
|
||||
_enemies = enemiesSoundListConfig.enemies;
|
||||
_dispatcher = dispatcherSoundListConfig.dispatcher;
|
||||
_audioTestClipsReferences = audioTestClipsConfig.audioTestClips;
|
||||
|
||||
MusicDictionary.Add(MusicType.Menu, new ());
|
||||
MusicDictionary.Add(MusicType.Peaceful, new ());
|
||||
@@ -77,12 +83,28 @@ namespace Code.Audio
|
||||
MusicDictionary[MusicType.Peaceful].Clear();
|
||||
_peacefulMusicHandle.Release();
|
||||
}
|
||||
public async UniTask WarmAudioTestClips( )
|
||||
{
|
||||
// _audioTestClipCounter = 0;
|
||||
_audioTestClipsHandle = Addressables.LoadAssetsAsync<AudioClip>(_audioTestClipsReferences, OnAudioTestClipLoaded, Addressables.MergeMode.Union);
|
||||
|
||||
// foreach (var assetReference in _menuSoundtrack) MenuMusic.Add(await assetReference.LoadAssetAsync<AudioClip>());
|
||||
var clips = (await _audioTestClipsHandle.ToUniTask()).ToList();
|
||||
|
||||
for (int i = 0; i < clips.Count; i++)
|
||||
AudioTestClips[(AudioType)i] = clips[i];
|
||||
}
|
||||
public void ReleaseAudioTestClips()
|
||||
{
|
||||
AudioTestClips.Clear();
|
||||
// foreach (var assetReference in _menuSoundtrack) assetReference.ReleaseAsset();
|
||||
_audioTestClipsHandle.Release();
|
||||
}
|
||||
public async UniTask WarmMenuMusic( )
|
||||
{
|
||||
_menuMusicHandle = Addressables.LoadAssetsAsync<AudioClip>(_menuSoundtrack, OnMenuTrackLoaded, Addressables.MergeMode.Union);
|
||||
// foreach (var assetReference in _menuSoundtrack) MenuMusic.Add(await assetReference.LoadAssetAsync<AudioClip>());
|
||||
await _menuMusicHandle.ToUniTask();
|
||||
|
||||
}
|
||||
public void ReleaseMenuMusic()
|
||||
{
|
||||
@@ -134,6 +156,12 @@ namespace Code.Audio
|
||||
{
|
||||
MusicDictionary[MusicType.Menu].Add(audioClip);
|
||||
}
|
||||
|
||||
// private int _audioTestClipCounter;
|
||||
private void OnAudioTestClipLoaded(AudioClip audioClip)
|
||||
{
|
||||
// AudioTestClips[(AudioType)_audioTestClipCounter] = audioClip;_audioTestClipCounter++;
|
||||
}
|
||||
private void OnActionTrackLoaded(AudioClip audioClip)
|
||||
{
|
||||
MusicDictionary[MusicType.Action].Add(audioClip);
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Threading;
|
||||
using Code.Configs;
|
||||
using Code.Constants;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using Reflex.Attributes;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
@@ -23,8 +24,9 @@ namespace Code.Audio
|
||||
|
||||
private AudioMixerGroup _masterGroup,
|
||||
// _musicGroup,
|
||||
// _actionMusicGroup,
|
||||
// _peacefulMusicGroup,
|
||||
_actionMusicGroup,
|
||||
_menuMusicGroup,
|
||||
_peacefulMusicGroup,
|
||||
_SFXGroup,
|
||||
_creaturesGroup,
|
||||
_dispatcherGroup,
|
||||
@@ -35,35 +37,104 @@ namespace Code.Audio
|
||||
|
||||
private Dictionary<AudioSnapshotState, AudioMixerSnapshot> _snapshots = new();
|
||||
private Dictionary<AudioSourceType, AudioSourceSettingsConfig> _settings;
|
||||
|
||||
public AudioService(IAudioFactory audioFactory, Dictionary<AudioSourceType,AudioSourceSettingsConfig> settings)
|
||||
|
||||
public AudioService(IAudioFactory audioFactory, Dictionary<AudioSourceType, AudioSourceSettingsConfig> settings)
|
||||
{
|
||||
_audioFactory = audioFactory;
|
||||
_audioSourcePool = new(settings);
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
// TODO Грязно, убрать снапшоты НАХУЙ
|
||||
public float GetSetting(AudioType type)
|
||||
{
|
||||
float value;
|
||||
switch (type)
|
||||
{
|
||||
case AudioType.SFX:
|
||||
_snapshots[AudioSnapshotState.Peaceful].audioMixer.GetFloat(_SFXGroup.name, out value);
|
||||
break;
|
||||
case AudioType.Master:
|
||||
_snapshots[AudioSnapshotState.Menu].audioMixer.GetFloat(_masterGroup.name, out value);
|
||||
break;
|
||||
case AudioType.Creatures:
|
||||
_snapshots[AudioSnapshotState.Peaceful].audioMixer.GetFloat(_creaturesGroup.name, out value);
|
||||
break;
|
||||
case AudioType.GameplayMusic:
|
||||
_snapshots[AudioSnapshotState.Peaceful].audioMixer.GetFloat(_peacefulMusicGroup.name, out value);
|
||||
break;
|
||||
case AudioType.MenuMusic:
|
||||
_snapshots[AudioSnapshotState.Menu].audioMixer.GetFloat(_menuMusicGroup.name, out value);
|
||||
break;
|
||||
case AudioType.DispatcherSounds:
|
||||
_snapshots[AudioSnapshotState.Action].audioMixer.GetFloat(_dispatcherGroup.name, out value);
|
||||
break;
|
||||
default:
|
||||
value = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
value = Mathf.Pow(10f, value / 20);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// TODO Грязно, убрать снапшоты НАХУЙ
|
||||
public void ChangeSetting(AudioType type, float value)
|
||||
{
|
||||
float volume = Mathf.Log10(value) * 20;
|
||||
switch (type)
|
||||
{
|
||||
case AudioType.SFX:
|
||||
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_SFXGroup.name, volume);
|
||||
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_SFXGroup.name, volume);
|
||||
break;
|
||||
case AudioType.Master:
|
||||
_snapshots[AudioSnapshotState.Menu].audioMixer.SetFloat(_masterGroup.name, volume);
|
||||
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_masterGroup.name, volume);
|
||||
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_masterGroup.name, volume);
|
||||
break;
|
||||
case AudioType.Creatures:
|
||||
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_creaturesGroup.name, volume);
|
||||
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_creaturesGroup.name, volume);
|
||||
break;
|
||||
case AudioType.GameplayMusic:
|
||||
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_peacefulMusicGroup.name, volume);
|
||||
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_actionMusicGroup.name, volume);
|
||||
break;
|
||||
case AudioType.MenuMusic:
|
||||
_snapshots[AudioSnapshotState.Menu].audioMixer.SetFloat(_menuMusicGroup.name, volume);
|
||||
break;
|
||||
case AudioType.DispatcherSounds:
|
||||
_snapshots[AudioSnapshotState.Peaceful].audioMixer.SetFloat(_dispatcherGroup.name, volume);
|
||||
_snapshots[AudioSnapshotState.Action].audioMixer.SetFloat(_dispatcherGroup.name, volume);
|
||||
break;
|
||||
}
|
||||
// _mixer.FindSnapshot("Action").audioMixer.SetFloat("music", volume);
|
||||
}
|
||||
|
||||
public async UniTask Initialize()
|
||||
{
|
||||
// _mixer = await _audioFactory.CreateMixer();
|
||||
_mixer = _audioFactory.AudioMixer;
|
||||
|
||||
_masterGroup = _mixer.FindMatchingGroups(AudioGroups.MasterGroup)[0];
|
||||
// _actionMusicGroup = _mixer.FindMatchingGroups(AudioGroups.ActionMusicGroup)[0];
|
||||
// _peacefulMusicGroup = _mixer.FindMatchingGroups(AudioGroups.PeacefulMusoup)[0];
|
||||
_menuMusicGroup = _mixer.FindMatchingGroups(AudioGroups.MenuMusicGroup)[0];
|
||||
_actionMusicGroup = _mixer.FindMatchingGroups(AudioGroups.ActionMusicGroup)[0];
|
||||
_peacefulMusicGroup = _mixer.FindMatchingGroups(AudioGroups.PeacefulMusicGroup)[0];
|
||||
// _musicGroup = _mixer.FindMatchingGroups(AudioGroups.MusicGroup)[0];
|
||||
_musicAudioGroups.Add(MusicType.Menu, _mixer.FindMatchingGroups(AudioGroups.MenuMusicGroup)[0]);
|
||||
_musicAudioGroups.Add(MusicType.Action, _mixer.FindMatchingGroups(AudioGroups.ActionMusicGroup)[0]);
|
||||
_musicAudioGroups.Add(MusicType.Peaceful, _mixer.FindMatchingGroups(AudioGroups.PeacefulMusicGroup)[0]);
|
||||
|
||||
|
||||
_cancellationTokenSources.Add(MusicType.Menu, new());
|
||||
_cancellationTokenSources.Add(MusicType.Action, new());
|
||||
_cancellationTokenSources.Add(MusicType.Peaceful, new());
|
||||
|
||||
|
||||
_musicAudioSources.Add(MusicType.Menu, null);
|
||||
_musicAudioSources.Add(MusicType.Action, null);
|
||||
_musicAudioSources.Add(MusicType.Peaceful, null);
|
||||
|
||||
|
||||
_SFXGroup = _mixer.FindMatchingGroups(AudioGroups.SFXGroup)[0];
|
||||
_creaturesGroup = _mixer.FindMatchingGroups(AudioGroups.CreaturesGroup)[0];
|
||||
_dispatcherGroup = _mixer.FindMatchingGroups(AudioGroups.DispatcherMusicGroup)[0];
|
||||
@@ -76,7 +147,6 @@ namespace Code.Audio
|
||||
_snapshots[AudioSnapshotState.Menu] = _mixer.FindSnapshot(AudioGroups.MenuSnapshot);
|
||||
|
||||
await _audioFactory.LoadAudioSourcePrefab(_audioSourcePool.Initialize);
|
||||
|
||||
}
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
@@ -86,50 +156,51 @@ namespace Code.Audio
|
||||
|
||||
public async UniTaskVoid PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(MusicType musicType)
|
||||
{
|
||||
if(!_musicAudioSources[musicType])
|
||||
if (!_musicAudioSources[musicType])
|
||||
{
|
||||
_musicAudioSources[musicType] = _audioSourcePool.GetSource();
|
||||
_musicAudioSources[musicType].spatialBlend = _settings[AudioSourceType.NoBlend].spatialBlend;
|
||||
_musicAudioSources[musicType].outputAudioMixerGroup = _musicAudioGroups[musicType];
|
||||
}
|
||||
|
||||
|
||||
_musicAudioSources[musicType].resource =
|
||||
_audioFactory.MusicDictionary[musicType][
|
||||
Random.Range(0, _audioFactory.MusicDictionary[musicType].Count)];
|
||||
|
||||
|
||||
_musicAudioSources[musicType].Play();
|
||||
|
||||
|
||||
// await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
||||
// _ => !_musicAudioSources[musicType].isPlaying,
|
||||
// cancellationToken: _cancellationTokenSources[musicType].Token);
|
||||
await UniTask.NextFrame();
|
||||
// Debug.Log($"Playing {musicType}");
|
||||
var (isCanceled, _) = await UniTask.WaitUntilValueChanged(_musicAudioSources[musicType],
|
||||
_ => !_musicAudioSources[musicType].isPlaying,
|
||||
_ => !_musicAudioSources[musicType].isPlaying,
|
||||
cancellationToken: _cancellationTokenSources[musicType].Token).SuppressCancellationThrow();
|
||||
// Debug.Log($"Finished {musicType}");
|
||||
|
||||
|
||||
if (isCanceled)
|
||||
{
|
||||
// Debug.Log($"Cancelled {musicType}");
|
||||
_cancellationTokenSources[musicType].Dispose();
|
||||
_cancellationTokenSources[musicType] = new();
|
||||
|
||||
|
||||
_audioSourcePool.ReleaseSource(_musicAudioSources[musicType]);
|
||||
_musicAudioSources[musicType] = null;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
PlayRandomMusicUntilHumanityWillBeDestroyedForTheySins(musicType);
|
||||
}
|
||||
|
||||
public async UniTaskVoid GladlyAskToStopMusic(MusicType musicType, AudioSnapshotState audioSnapshotState = AudioSnapshotState.None, float time = 1f, Action callback = null)
|
||||
|
||||
public async UniTaskVoid GladlyAskToStopMusic(MusicType musicType,
|
||||
AudioSnapshotState audioSnapshotState = AudioSnapshotState.None, float time = 1f, Action callback = null)
|
||||
{
|
||||
TransitToSnapshot(audioSnapshotState, time);
|
||||
|
||||
await UniTask.WaitForSeconds(time);
|
||||
|
||||
|
||||
_cancellationTokenSources[musicType].Cancel();
|
||||
|
||||
callback?.Invoke();
|
||||
@@ -170,10 +241,112 @@ namespace Code.Audio
|
||||
// Чинить долго и дорого пусть Артёмов будет много, ведь он наш друг
|
||||
public event IAudioService.OnAudioPlayingDelegate OnDispatcherStarted;
|
||||
public event IAudioService.OnAudioPlayingDelegate OnDispatcherEnded;
|
||||
|
||||
public void PlayDispatcher(DispatcherSounds dispatcherSoundId)
|
||||
{
|
||||
OnDispatcherStarted?.Invoke();
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.DispatcherAudios[(int)dispatcherSoundId], _dispatcherGroup, AudioSourceType.NoBlend, () => OnDispatcherEnded?.Invoke());
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.DispatcherAudios[(int)dispatcherSoundId], _dispatcherGroup,
|
||||
AudioSourceType.NoBlend, () => OnDispatcherEnded?.Invoke());
|
||||
}
|
||||
|
||||
private CancellationTokenSource _testClipCancellationTokenSource = new();
|
||||
private void ResetCurrentTestAudioSource() => _currentTestClipAudioType = AudioType.Master;
|
||||
// TODO Засунуть в словарь
|
||||
public void PlayTestClip(AudioType audioType)
|
||||
{
|
||||
if(_currentTestClipAudioType == audioType) return;
|
||||
|
||||
_testClipCancellationTokenSource.Cancel();
|
||||
_testClipCancellationTokenSource = new();
|
||||
|
||||
_currentTestClipAudioType = audioType;
|
||||
|
||||
switch (audioType)
|
||||
{
|
||||
case AudioType.SFX:
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||
_SFXGroup, _testClipCancellationTokenSource,
|
||||
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||
break;
|
||||
case AudioType.Master:
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||
_masterGroup, _testClipCancellationTokenSource,
|
||||
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||
break;
|
||||
case AudioType.Creatures:
|
||||
_audioSourcePool.PlayOneShot( _audioFactory.AudioTestClips[audioType],
|
||||
_creaturesGroup, _testClipCancellationTokenSource,
|
||||
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||
break;
|
||||
case AudioType.GameplayMusic:
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||
_actionMusicGroup, _testClipCancellationTokenSource,
|
||||
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||
break;
|
||||
case AudioType.MenuMusic:
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||
_menuMusicGroup, _testClipCancellationTokenSource,
|
||||
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||
break;
|
||||
case AudioType.DispatcherSounds:
|
||||
_audioSourcePool.PlayOneShot(_audioFactory.AudioTestClips[audioType],
|
||||
_dispatcherGroup, _testClipCancellationTokenSource,
|
||||
AudioSourceType.NoBlend, ResetCurrentTestAudioSource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private AudioSource _testClipAudioSource;
|
||||
private AudioType _currentTestClipAudioType;
|
||||
|
||||
// Эффективно и просто, может не так хитровыебано
|
||||
private void ReleaseTestAudioClipSource()
|
||||
{
|
||||
_testClipAudioSource = null;
|
||||
}
|
||||
|
||||
// TODO Засунуть в словарь
|
||||
public void PlayTestClipDeprecated(AudioType audioType)
|
||||
{
|
||||
if (!_testClipAudioSource) _testClipAudioSource = _audioSourcePool.GetSource();
|
||||
else if (_currentTestClipAudioType != audioType) _testClipAudioSource.Stop();
|
||||
else return;
|
||||
|
||||
_currentTestClipAudioType = audioType;
|
||||
|
||||
switch (audioType)
|
||||
{
|
||||
case AudioType.SFX:
|
||||
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||
_SFXGroup,
|
||||
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||
break;
|
||||
case AudioType.Master:
|
||||
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||
_masterGroup,
|
||||
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||
break;
|
||||
case AudioType.Creatures:
|
||||
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||
_creaturesGroup,
|
||||
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||
break;
|
||||
case AudioType.GameplayMusic:
|
||||
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||
_actionMusicGroup,
|
||||
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||
break;
|
||||
case AudioType.MenuMusic:
|
||||
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||
_menuMusicGroup,
|
||||
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||
break;
|
||||
case AudioType.DispatcherSounds:
|
||||
_audioSourcePool.PlayOneShot(_testClipAudioSource, _audioFactory.AudioTestClips[audioType],
|
||||
_dispatcherGroup,
|
||||
AudioSourceType.NoBlend, ReleaseTestAudioClipSource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Code.Configs;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
@@ -86,6 +87,34 @@ namespace Code.Audio
|
||||
onComplete?.Invoke();
|
||||
_pool.Release(source);
|
||||
}
|
||||
public async UniTaskVoid PlayOneShot(AudioSource audioSource, AudioClip clip, AudioMixerGroup audioMixerGroup, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
|
||||
{
|
||||
audioSource.PlayOneShot(clip);
|
||||
audioSource.spatialBlend = _settings[audioSourceType].spatialBlend;
|
||||
audioSource.outputAudioMixerGroup = audioMixerGroup;
|
||||
|
||||
// TODO Потом сделать. Можно с cancellation, но сейчас лень. Ну правда
|
||||
await UniTask.WaitUntilValueChanged(audioSource, x => x.isPlaying);
|
||||
|
||||
if (!audioSource) return;
|
||||
|
||||
_pool.Release(audioSource);
|
||||
onComplete?.Invoke();
|
||||
}
|
||||
public async UniTaskVoid PlayOneShot(AudioClip clip, AudioMixerGroup audioMixerGroup, CancellationTokenSource cancellationToken, AudioSourceType audioSourceType = AudioSourceType.NoBlend, Action onComplete = null)
|
||||
{
|
||||
AudioSource source = _pool.Get();
|
||||
source.PlayOneShot(clip);
|
||||
source.spatialBlend = _settings[audioSourceType].spatialBlend;
|
||||
source.outputAudioMixerGroup = audioMixerGroup;
|
||||
|
||||
var (isCanceled, _) = await UniTask.WaitUntilValueChanged(source, x => x.isPlaying, cancellationToken: cancellationToken.Token).SuppressCancellationThrow();
|
||||
|
||||
_pool.Release(source);
|
||||
|
||||
if(!isCanceled) onComplete?.Invoke();
|
||||
else cancellationToken.Dispose();
|
||||
}
|
||||
public AudioSource GetSource() => _pool.Get();
|
||||
public void ReleaseSource(AudioSource source) => _pool.Release(source);
|
||||
}
|
||||
|
||||
@@ -8,22 +8,25 @@ namespace Code.Audio
|
||||
{
|
||||
public interface IAudioFactory
|
||||
{
|
||||
AudioMixer AudioMixer { get; }
|
||||
Dictionary<AudioType, AudioClip> AudioTestClips { get; }
|
||||
Dictionary<MusicType, List<AudioClip>> MusicDictionary { get; }
|
||||
List<AudioClip> SFXAudios { get; }
|
||||
List<AudioClip> EnemiesAudios { get; }
|
||||
List<AudioClip> DispatcherAudios { get; }
|
||||
AudioMixer AudioMixer { get; }
|
||||
Dictionary<MusicType, List<AudioClip>> MusicDictionary { get; }
|
||||
UniTask LoadAudioSourcePrefab(Action<GameObject> callback);
|
||||
UniTask WarmGameplayMusic();
|
||||
UniTask WarmGameplayMusic( );
|
||||
void ReleaseActionMusic();
|
||||
UniTask WarmMenuMusic();
|
||||
void ReleaseMenuMusic();
|
||||
UniTask WarmSFX();
|
||||
void ReleaseSFX();
|
||||
UniTask WarmEnemies();
|
||||
void ReleaseEnemies();
|
||||
UniTask WarmDispatcher();
|
||||
void ReleaseDispatcher();
|
||||
void ReleasePeacefulMusic();
|
||||
UniTask WarmAudioTestClips( );
|
||||
void ReleaseAudioTestClips();
|
||||
UniTask WarmMenuMusic( );
|
||||
void ReleaseMenuMusic();
|
||||
UniTask WarmSFX( );
|
||||
void ReleaseSFX();
|
||||
UniTask WarmEnemies( );
|
||||
void ReleaseEnemies();
|
||||
UniTask WarmDispatcher( );
|
||||
void ReleaseDispatcher();
|
||||
}
|
||||
}
|
||||
@@ -20,5 +20,8 @@ namespace Code.Audio
|
||||
event OnAudioPlayingDelegate OnDispatcherStarted;
|
||||
event OnAudioPlayingDelegate OnDispatcherEnded;
|
||||
void PlayDispatcher(DispatcherSounds dispatcherSoundId);
|
||||
void ChangeSetting(AudioType type, float value);
|
||||
float GetSetting(AudioType type);
|
||||
void PlayTestClip(AudioType audioType);
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,13 @@ namespace Code.Audio
|
||||
Peaceful,
|
||||
Action
|
||||
}
|
||||
public enum AudioType
|
||||
{
|
||||
Master,
|
||||
MenuMusic,
|
||||
GameplayMusic,
|
||||
Creatures,
|
||||
DispatcherSounds,
|
||||
SFX
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace Code.Configs
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Config/Audio/AudioTestClips", fileName = "AudioTestClipsConfig")]
|
||||
public class AudioTestClipsConfig : ScriptableObject
|
||||
{
|
||||
public AssetReference[] audioTestClips;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2f1c08a20a54a708336caf8ca6499e1
|
||||
timeCreated: 1764263243
|
||||
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Gameplay.Door
|
||||
{
|
||||
public class Door : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform hingeJointAnchor;
|
||||
[SerializeField] private HingeJoint hingeJoint;
|
||||
[SerializeField] private Rigidbody rigidbody;
|
||||
|
||||
public void TranslationMode(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
rigidbody.isKinematic = true;
|
||||
return;
|
||||
}
|
||||
rigidbody.isKinematic = false;
|
||||
hingeJoint.autoConfigureConnectedAnchor = false;
|
||||
hingeJoint.connectedAnchor = hingeJointAnchor.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc9fc6ce2cc24b68b2b330e4fd029b80
|
||||
timeCreated: 1764304430
|
||||
@@ -33,7 +33,7 @@ namespace Code.Gameplay.Orders.Order
|
||||
}
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (!_pickupMode) return;
|
||||
if (!_pickupMode || !other.CompareTag("Player")) return;
|
||||
|
||||
_orderService.OrderRecieved();
|
||||
Destroy(gameObject);
|
||||
|
||||
@@ -14,18 +14,20 @@ namespace Code.Gameplay.Orders.Order
|
||||
hatch.DORotate(new Vector3(-130f, 0, 0), 0.2f);
|
||||
|
||||
order.rigidbody.isKinematic = false;
|
||||
order.rigidbody.AddForce(-transform.forward * 10f, ForceMode.Impulse);
|
||||
order.rigidbody.AddForce(-transform.forward * 1f, ForceMode.Impulse);
|
||||
|
||||
order.SwitchMode();
|
||||
}
|
||||
|
||||
// DEBUG TODO ДИМКА УДАЛИ И ПРОПИШИ В СВОЕЙ ЛОГИКЕ
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if(_activated) return;
|
||||
_activated = true;
|
||||
|
||||
ThrowOrder();
|
||||
order.SwitchMode();
|
||||
}
|
||||
// public void OnTriggerEnter(Collider other)
|
||||
// {
|
||||
// if(_activated) return;
|
||||
// _activated = true;
|
||||
//
|
||||
// ThrowOrder();
|
||||
// order.SwitchMode();
|
||||
// }
|
||||
// DEBUG
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Gameplay.Orders.Order
|
||||
{
|
||||
public class RoomDispenserTrigger : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private OrderDispenser orderDispenser;
|
||||
private bool _playerEntered;
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (_playerEntered || !other.CompareTag("Player")) return;
|
||||
orderDispenser.ThrowOrder();
|
||||
_playerEntered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 630780fe69aa45eda7d4bcf966516c7d
|
||||
timeCreated: 1764313014
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b32d6ce440f44fd3abadaa489a44890c
|
||||
timeCreated: 1762797763
|
||||
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
|
||||
namespace Code.Generator
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Config/GeneratorConfig", fileName = "GeneratorConfig")]
|
||||
public class GeneratorConfig : ScriptableObject
|
||||
{
|
||||
public AssetReference[] roomAssetReferences;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a7c77305de54155b5b94b607531ee3c
|
||||
timeCreated: 1762453750
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
using Code.Gameplay.Orders.Order;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Generator
|
||||
{
|
||||
public interface IRoomGeneratorFactory
|
||||
{
|
||||
UniTask PreloadRooms(IOrderService orderService);
|
||||
GameObject GetCachedPrefab(int index, RoomType roomType);
|
||||
Room CreateRoomByIndex(int index, RoomType roomType);
|
||||
void ReleaseRooms();
|
||||
GameObject GetRandomCachedPrefabOfType(RoomType roomType, out int index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3fca4115e714519b869eb72d856e89f
|
||||
timeCreated: 1762453657
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Code.Gameplay.Door;
|
||||
using Code.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Generator
|
||||
{
|
||||
[RequireComponent(typeof(Transform))]
|
||||
public class Room : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private RoomType roomType;
|
||||
public RoomType RoomType => roomType;
|
||||
[SerializeField] private float roomTimer;
|
||||
public float RoomTimer => roomTimer;
|
||||
[SerializeField] private Transform enterMarker;
|
||||
public Transform EnterMarker => enterMarker;
|
||||
[SerializeField] private Transform exitMarker;
|
||||
public Transform ExitMarker => exitMarker;
|
||||
[SerializeField] private Door door;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (EnterMarker == null || ExitMarker == null)
|
||||
{
|
||||
Debug.LogError($"Але маркеры не найдены у комнаты {gameObject.name}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize() => door.TranslationMode(false);
|
||||
|
||||
//PIZDEC
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ba1a19c534f4401aa287d4b68ce470c
|
||||
timeCreated: 1762014278
|
||||
@@ -0,0 +1,308 @@
|
||||
using System.Collections.Generic;
|
||||
using Code.Gameplay.Orders.Order;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Generator
|
||||
{
|
||||
public class RoomGenerator
|
||||
{
|
||||
[Inject] private IOrderService _orderService;
|
||||
|
||||
[Inject] private GeneratorConfig generatorConfig;
|
||||
|
||||
[Inject] private IRoomGeneratorFactory _factory;
|
||||
|
||||
private List<RoomIndex> _roomIndexesStack;
|
||||
|
||||
private struct RoomIndex
|
||||
{
|
||||
public RoomType RoomType;
|
||||
public int Index;
|
||||
|
||||
public RoomIndex(RoomType roomType, int index)
|
||||
{
|
||||
RoomType = roomType;
|
||||
Index = index;
|
||||
}
|
||||
}
|
||||
|
||||
private List<Room> _spawnedRooms;
|
||||
|
||||
private int _nextRoomStackIndex;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// _orderService.OrderGive();
|
||||
|
||||
_spawnedRooms = new List<Room>();
|
||||
_roomIndexesStack = new();
|
||||
|
||||
Debug.LogWarning($"КОТЛЫ ГЕНЕРАЛЬСКИЕ{_orderService.DeliveryTimer}");
|
||||
|
||||
// CreateRoomsStack();
|
||||
|
||||
// SpawnInitialRoomsAsync();
|
||||
_orderService.OnOrderGiven += CreateRoomsStack;
|
||||
RoomTrigger.PlayerEnteredRoom += OnPlayerEntered;
|
||||
|
||||
CreateSaveRoom();
|
||||
SpawnNextRoomAsync();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
RoomTrigger.PlayerEnteredRoom += OnPlayerEntered;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
RoomTrigger.PlayerEnteredRoom -= OnPlayerEntered;
|
||||
}
|
||||
|
||||
public void OnPlayerEntered()
|
||||
{
|
||||
SpawnNextRoomAsync();
|
||||
|
||||
if (_spawnedRooms.Count > 3)
|
||||
{
|
||||
Room roomToRemove = _spawnedRooms[0];
|
||||
_spawnedRooms.RemoveAt(0);
|
||||
|
||||
// _factory.ReleaseRoom(roomToRemove);
|
||||
Object.Destroy(roomToRemove.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateRoomsStack(float timer)
|
||||
{
|
||||
var currentSaveRoom = _roomIndexesStack[^1];
|
||||
_roomIndexesStack.Clear();
|
||||
_roomIndexesStack.Add(currentSaveRoom);
|
||||
|
||||
var remainingTime = timer;
|
||||
|
||||
while (remainingTime > 0)
|
||||
{
|
||||
var prefab = _factory.GetRandomCachedPrefabOfType(RoomType.Basic, out int roomIndex);
|
||||
|
||||
Room room = prefab.GetComponent<Room>();
|
||||
|
||||
_roomIndexesStack.Add(new(RoomType.Basic, roomIndex));
|
||||
remainingTime -= room.RoomTimer;
|
||||
Debug.Log($"комната {room.name} время {room.RoomTimer} осталось: {remainingTime}");
|
||||
}
|
||||
|
||||
AddPickupRoom();
|
||||
|
||||
CreateSaveRoom();
|
||||
|
||||
Debug.Log($"стек комнат: {_roomIndexesStack.Count}");
|
||||
}
|
||||
|
||||
private void CreateSaveRoom()
|
||||
{
|
||||
var prefab = _factory.GetRandomCachedPrefabOfType(RoomType.Save, out int roomIndex);
|
||||
Room saveRoom = prefab.GetComponent<Room>();
|
||||
_roomIndexesStack.Add(new(RoomType.Save, roomIndex));
|
||||
|
||||
Debug.Log($"Первая комната: {saveRoom.name}");
|
||||
}
|
||||
|
||||
private async UniTask SpawnInitialRoomsAsync()
|
||||
{
|
||||
_nextRoomStackIndex = 0;
|
||||
|
||||
SpawnNextRoomAsync();
|
||||
|
||||
SpawnNextRoomAsync();
|
||||
}
|
||||
|
||||
private void SpawnNextRoomAsync()
|
||||
{
|
||||
if (_nextRoomStackIndex >= _roomIndexesStack.Count)
|
||||
return;
|
||||
|
||||
RoomIndex index = _roomIndexesStack[_nextRoomStackIndex];
|
||||
Room room = _factory.CreateRoomByIndex(index.Index, index.RoomType);
|
||||
|
||||
if (_spawnedRooms.Count == 0)
|
||||
{
|
||||
room.transform.position = Vector3.zero;
|
||||
room.transform.rotation = Quaternion.identity;
|
||||
}
|
||||
else
|
||||
{
|
||||
Room previousRoom = _spawnedRooms[_spawnedRooms.Count - 1];
|
||||
PlaceRoom(room, previousRoom);
|
||||
}
|
||||
|
||||
_spawnedRooms.Add(room);
|
||||
_nextRoomStackIndex++;
|
||||
}
|
||||
|
||||
private void AddPickupRoom()
|
||||
{
|
||||
var prefab = _factory.GetRandomCachedPrefabOfType(RoomType.PickUp, out int pickupIndex);
|
||||
|
||||
Room pickupRoom = prefab.GetComponent<Room>();
|
||||
|
||||
if (_roomIndexesStack.Count == 0)
|
||||
{
|
||||
Debug.LogWarning("Стек пуст, нет позиции после первой");
|
||||
return;
|
||||
}
|
||||
|
||||
int insertPos = Random.Range(1, _roomIndexesStack.Count + 1);
|
||||
|
||||
_roomIndexesStack.Insert(insertPos, new(RoomType.PickUp, pickupIndex));
|
||||
Debug.Log($"PickUp комната '{pickupRoom.name}' позиция {insertPos}");
|
||||
}
|
||||
|
||||
|
||||
private void PlaceRoom(Room current, Room previous)
|
||||
{
|
||||
if (current.EnterMarker == null || previous.ExitMarker == null)
|
||||
return;
|
||||
|
||||
Vector3 segmentOriginPosition = previous.ExitMarker.transform.position;
|
||||
|
||||
Transform randomDoorOrigin = current.EnterMarker;
|
||||
Vector3 randomDoorOriginPosition = randomDoorOrigin.localPosition * current.transform.localScale.x;
|
||||
Quaternion randomDoorOriginRotation = randomDoorOrigin.localRotation;
|
||||
|
||||
float segmentOriginYRotation;
|
||||
|
||||
float entityRotation = previous.ExitMarker.transform.rotation.eulerAngles.y;
|
||||
if (entityRotation > 305f) entityRotation -= 360f;
|
||||
else if (entityRotation < -45f) entityRotation += 360f;
|
||||
|
||||
if (entityRotation > 135f)
|
||||
segmentOriginYRotation = entityRotation - randomDoorOriginRotation.eulerAngles.y + 180f;
|
||||
else
|
||||
segmentOriginYRotation = entityRotation - randomDoorOriginRotation.eulerAngles.y - 180f;
|
||||
|
||||
if (segmentOriginYRotation < -45f) segmentOriginYRotation += 360f;
|
||||
else if (segmentOriginYRotation > 305f) segmentOriginYRotation -= 360f;
|
||||
else if (segmentOriginYRotation < -305f) segmentOriginYRotation += 720f;
|
||||
|
||||
if (segmentOriginYRotation is > -45f and < 45f)
|
||||
{
|
||||
segmentOriginPosition.x -= randomDoorOriginPosition.x;
|
||||
segmentOriginPosition.z -= randomDoorOriginPosition.z;
|
||||
}
|
||||
else if (segmentOriginYRotation is >= 45f and < 135f)
|
||||
{
|
||||
segmentOriginPosition.x -= randomDoorOriginPosition.z;
|
||||
segmentOriginPosition.z += randomDoorOriginPosition.x;
|
||||
}
|
||||
else if (segmentOriginYRotation is >= 135f and < 225f)
|
||||
{
|
||||
segmentOriginPosition.x += randomDoorOriginPosition.x;
|
||||
segmentOriginPosition.z += randomDoorOriginPosition.z;
|
||||
}
|
||||
else if (segmentOriginYRotation is >= 225f and < 305f)
|
||||
{
|
||||
segmentOriginPosition.x += randomDoorOriginPosition.z;
|
||||
segmentOriginPosition.z -= randomDoorOriginPosition.x;
|
||||
}
|
||||
|
||||
segmentOriginPosition.y -= randomDoorOriginPosition.y;
|
||||
current.transform.position = segmentOriginPosition;
|
||||
current.transform.rotation = Quaternion.Euler(0, segmentOriginYRotation, 0);
|
||||
// locationSegment.isNeedSomeDoors = true;
|
||||
// locationSegment.AddBadDoorId(locationSegment.LocationSegment.GetDoorOrigins.IndexOf(randomDoorOrigin));
|
||||
current.Initialize();
|
||||
|
||||
float frameOnTheBallRotation = segmentOriginYRotation + randomDoorOriginRotation.eulerAngles.y;
|
||||
if (frameOnTheBallRotation > 305f) frameOnTheBallRotation -= 360f;
|
||||
else if (frameOnTheBallRotation < -45f) frameOnTheBallRotation += 360f;
|
||||
|
||||
// heOnTheBall.AddSlaveLocationSegment(locationSegment.Id);
|
||||
// heOnTheBall.ReplaceSlaveSegmentDoorOriginYRotation(frameOnTheBallRotation);
|
||||
// heOnTheBall.isGotOnTheBall = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// private void CreateRoomsStackDimka()
|
||||
// {
|
||||
// _roomIndexesStack.Clear();
|
||||
// var remainingTime = _orderService.DeliveryTimer;
|
||||
// float ladderTimer = 0f;
|
||||
// int totalRooms = generatorConfig.roomAssetReferences.Length;
|
||||
// List<int> availableIndexes = new List<int>();
|
||||
// for (int i = 0; i < totalRooms; i++)
|
||||
// availableIndexes.Add(i);
|
||||
//
|
||||
// int saveIndex = FindRoomIndexByType(RoomType.Save);
|
||||
// if (saveIndex != -1)
|
||||
// {
|
||||
// var prefab = _factory.GetCachedPrefab(saveIndex);
|
||||
// if (prefab != null)
|
||||
// {
|
||||
// Room saveRoom = prefab.GetComponent<Room>();
|
||||
// if (saveRoom != null)
|
||||
// {
|
||||
// _roomIndexesStack.Add(saveIndex);
|
||||
// availableIndexes.Remove(saveIndex);
|
||||
//
|
||||
// Debug.Log($"Первая комната: {saveRoom.name}");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// while (remainingTime > 0 && availableIndexes.Count > 0)
|
||||
// {
|
||||
// int randomIndex = Random.Range(0, availableIndexes.Count);
|
||||
// int chosenOne = availableIndexes[randomIndex];
|
||||
//
|
||||
// var prefab = _factory.GetCachedPrefab(chosenOne);
|
||||
// if (prefab == null)
|
||||
// continue;
|
||||
//
|
||||
// Room room = prefab.GetComponent<Room>();
|
||||
// if (room == null)
|
||||
// continue;
|
||||
//
|
||||
// switch (room.RoomType)
|
||||
// {
|
||||
// case RoomType.Save or RoomType.PickUp:
|
||||
// availableIndexes.RemoveAt(randomIndex);
|
||||
// continue;
|
||||
//
|
||||
// case RoomType.Basic:
|
||||
// float currentRoomTime = room.RoomTimer;
|
||||
// if (remainingTime >= currentRoomTime && ladderTimer < 30f)
|
||||
// {
|
||||
// _roomIndexesStack.Add(chosenOne);
|
||||
// remainingTime -= currentRoomTime;
|
||||
// ladderTimer += currentRoomTime;
|
||||
// Debug.Log($"комната {room.name} время {currentRoomTime} осталось: {remainingTime}");
|
||||
// }
|
||||
//
|
||||
// availableIndexes.RemoveAt(randomIndex);
|
||||
// break;
|
||||
//
|
||||
// case RoomType.Ladder:
|
||||
// if (ladderTimer >= 30f)
|
||||
// {
|
||||
// _roomIndexesStack.Add(chosenOne);
|
||||
// ladderTimer = 0f;
|
||||
//
|
||||
// availableIndexes.RemoveAt(randomIndex);
|
||||
// Debug.Log($"Лестница ура {room.name}");
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// Debug.Log($"тип комнаты {room.RoomType}");
|
||||
// availableIndexes.RemoveAt(randomIndex);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// AddPickupRoom();
|
||||
// Debug.Log($"стек комнат: {_roomIndexesStack.Count}");
|
||||
// }
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 353230beca35458dafc91c6409c25ab3
|
||||
timeCreated: 1762014615
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Code.Configs;
|
||||
using Code.Gameplay.Orders.Order;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Reflex.Extensions;
|
||||
using Reflex.Injectors;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
using UnityEngine.ResourceManagement.AsyncOperations;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Object = System.Object;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Code.Generator
|
||||
{
|
||||
public class RoomGeneratorFactory : IRoomGeneratorFactory
|
||||
{
|
||||
private AsyncOperationHandle<IList<GameObject>> _roomsHandle;
|
||||
private readonly AssetReference[] _roomAssetReferences;
|
||||
private Dictionary<RoomType, List<GameObject>> _cashedRooms = new();
|
||||
|
||||
public RoomGeneratorFactory(GeneratorConfig generatorConfig)
|
||||
{
|
||||
_roomAssetReferences = generatorConfig.roomAssetReferences;
|
||||
// _cashedRooms = new GameObject[_roomAssetReferences.Length];
|
||||
_cashedRooms.Add(RoomType.Basic, new());
|
||||
_cashedRooms.Add(RoomType.Save, new ());
|
||||
_cashedRooms.Add(RoomType.PickUp, new ());
|
||||
}
|
||||
|
||||
public async UniTask PreloadRooms(IOrderService orderService)
|
||||
{
|
||||
_roomsHandle =
|
||||
Addressables.LoadAssetsAsync<GameObject>(_roomAssetReferences, OnRoomLoaded, Addressables.MergeMode.Union);
|
||||
await _roomsHandle.ToUniTask();
|
||||
// _cashedRooms = rooms.ToArray(); var rooms =
|
||||
|
||||
// Debug.Log($"Комнат в памяти есть: {_cashedRooms.Length}");
|
||||
}
|
||||
|
||||
private void OnRoomLoaded(GameObject room)
|
||||
{
|
||||
var temp = room.GetComponent<Room>();
|
||||
_cashedRooms[temp.RoomType].Add(room);
|
||||
}
|
||||
public GameObject GetCachedPrefab(int index, RoomType roomType)
|
||||
{
|
||||
if (index < 0 || index >= _cashedRooms[roomType].Count)
|
||||
return null;
|
||||
return _cashedRooms[roomType][index];
|
||||
}
|
||||
public GameObject GetRandomCachedPrefabOfType(RoomType roomType, out int index)
|
||||
{
|
||||
index = Random.Range(0, _cashedRooms[roomType].Count);
|
||||
return _cashedRooms[roomType][index];
|
||||
}
|
||||
|
||||
public Room CreateRoomByIndex(int index, RoomType roomType)
|
||||
{
|
||||
var room = UnityEngine.Object.Instantiate(_cashedRooms[roomType][index]);
|
||||
return room.GetComponent<Room>();
|
||||
}
|
||||
public void ReleaseRooms()
|
||||
{
|
||||
_roomsHandle.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6e5b72284354ba79ec5b89cf06f1203
|
||||
timeCreated: 1762454256
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Code.Gameplay.Orders.Order;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Generator
|
||||
{
|
||||
public class RoomTrigger : MonoBehaviour
|
||||
{
|
||||
[Inject] private IOrderService _orderService;
|
||||
|
||||
public static event Action PlayerEnteredRoom;
|
||||
|
||||
private bool _playerEntered;
|
||||
|
||||
// [Inject]
|
||||
// private void Construct(IOrderService orderService)
|
||||
// {
|
||||
// _orderService = orderService;
|
||||
// }
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (_playerEntered) return;
|
||||
if (!other.CompareTag("Player")) return;
|
||||
|
||||
_playerEntered = true;
|
||||
|
||||
_orderService.RoomPassed();
|
||||
|
||||
PlayerEnteredRoom?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4207b7568dc3482393ac1860a31909b4
|
||||
timeCreated: 1764087485
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Code.Generator
|
||||
{
|
||||
public enum RoomType
|
||||
{
|
||||
Basic,
|
||||
Ladder,
|
||||
Save,
|
||||
PickUp
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 304fa5ed27cc4bc3aabcfeb272206d89
|
||||
timeCreated: 1762945420
|
||||
@@ -7,15 +7,11 @@ namespace Code.Scenes.SceneEnvironments
|
||||
[System.Serializable]
|
||||
public class GameplaySceneEnvironment : CurrentSceneEnvironment
|
||||
{
|
||||
[FormerlySerializedAs("sfxTarget")] public Transform debugSfxTarget;
|
||||
public Transform playerSpawnPoint;
|
||||
public OrderDispenser debugTube;
|
||||
public Transform playerSpawnPoint;
|
||||
|
||||
public void TransitVariables(GameplaySceneEnvironment env)
|
||||
{
|
||||
debugSfxTarget = env.debugSfxTarget;
|
||||
playerSpawnPoint = env.playerSpawnPoint;
|
||||
debugTube = env.debugTube;
|
||||
playerSpawnPoint = env.playerSpawnPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Code.Gameplay.Door;
|
||||
using Code.UI;
|
||||
using Code.UI.Panels.Etc;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.GlobalIllumination;
|
||||
@@ -15,6 +16,7 @@ namespace Code.Scenes.SceneEnvironments
|
||||
public MainMenuButton settingButton;
|
||||
public MainMenuButton exitButton;
|
||||
public Canvas menuButtonsCanvas;
|
||||
public Canvas settingsCanvas;
|
||||
|
||||
public void TransitVariables(MainMenuEnvironment env)
|
||||
{
|
||||
@@ -24,6 +26,7 @@ namespace Code.Scenes.SceneEnvironments
|
||||
settingButton = env.settingButton;
|
||||
exitButton = env.exitButton;
|
||||
menuButtonsCanvas = env.menuButtonsCanvas;
|
||||
settingsCanvas = env.settingsCanvas;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||
using Code.Audio;
|
||||
using Code.Configs;
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Generator;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
@@ -30,6 +31,8 @@ namespace Code.StaticData
|
||||
OrderBoxConfig OrderBoxConfig { get; }
|
||||
Dictionary<CameraMode, CameraSettingsConfig> CameraSettingsConfigs { get; }
|
||||
Dictionary<AudioSourceType, AudioSourceSettingsConfig> AudioSourceSettingsConfigs { get; }
|
||||
AudioTestClipsConfig AudioTestClipsConfig { get; }
|
||||
GeneratorConfig GeneratorConfig { get; }
|
||||
void Load();
|
||||
Task<T> InstantiateAsset<T>(AssetReference assetReference) where T : Behaviour;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using Code.Audio;
|
||||
using Code.Configs;
|
||||
using Code.Constants;
|
||||
using Code.Gameplay.Camera;
|
||||
using Code.Generator;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AddressableAssets;
|
||||
@@ -16,20 +17,27 @@ namespace Code.StaticData
|
||||
public AppConfig AppConfig { get; private set; }
|
||||
public InputConfig InputConfig { get; private set; }
|
||||
public CameraConfig CameraConfig { get; private set; }
|
||||
|
||||
public CharacterConfig CharacterConfig { get; private set; }
|
||||
public UIConfig UIConfig { get; private set; }
|
||||
public PlayerConfig PlayerConfig { get; private set; }
|
||||
|
||||
public UIConfig UIConfig { get; private set; }
|
||||
|
||||
public AudioMixerConfig AudioMixerConfig { get; private set; }
|
||||
public SoundtrackListConfig SoundtrackListConfig { get; private set; }
|
||||
public SFXListConfig SFXListConfig { get; private set; }
|
||||
public DispatcherSoundListConfig DispatcherSoundListConfig { get; private set; }
|
||||
public EnemiesSoundListConfig EnemiesSoundListConfig { get; private set; }
|
||||
public AudioTestClipsConfig AudioTestClipsConfig { get; private set; }
|
||||
|
||||
public DrunkenGrandpaConfig DrunkenGrandpaConfig {get; private set;}
|
||||
public CockroachConfig CockroachConfig { get; private set; }
|
||||
public FogConfig FogConfig { get; private set; }
|
||||
|
||||
public OrderServiceConfig OrderServiceConfig { get; private set; }
|
||||
public OrderBoxConfig OrderBoxConfig { get; private set; }
|
||||
|
||||
public GeneratorConfig GeneratorConfig { get; private set; }
|
||||
|
||||
public Dictionary<CameraMode, CameraSettingsConfig> CameraSettingsConfigs { get; private set; } = new();
|
||||
|
||||
@@ -44,6 +52,7 @@ namespace Code.StaticData
|
||||
PlayerConfig = Resources.Load<PlayerConfig>(string.Format(StringPaths.ConfigSingle, "App", "PlayerConfig"));
|
||||
OrderServiceConfig = Resources.Load<OrderServiceConfig>(string.Format(StringPaths.ConfigSingle, "Gameplay", "OrderServiceConfig"));
|
||||
OrderBoxConfig = Resources.Load<OrderBoxConfig>(string.Format(StringPaths.ConfigSingle, "Gameplay", "OrderBoxConfig"));
|
||||
GeneratorConfig = Resources.Load<GeneratorConfig>(string.Format(StringPaths.ConfigSingle, "App", "GeneratorConfig"));
|
||||
|
||||
CameraConfig = Resources.Load<CameraConfig>(string.Format(StringPaths.ConfigSingle, "Camera", "CameraConfig"));
|
||||
CameraSettingsConfigs = Resources
|
||||
@@ -58,6 +67,7 @@ namespace Code.StaticData
|
||||
{
|
||||
AudioMixerConfig = Resources.Load<AudioMixerConfig>(string.Format(StringPaths.ConfigSingle, "Audio", "AudioMixerConfig"));
|
||||
SoundtrackListConfig = Resources.Load<SoundtrackListConfig>(string.Format(StringPaths.ConfigSingle, "Audio", "SoundtrackListConfig"));
|
||||
AudioTestClipsConfig = Resources.Load<AudioTestClipsConfig>(string.Format(StringPaths.ConfigSingle, "Audio", "AudioTestClipsConfig"));
|
||||
SFXListConfig = Resources.Load<SFXListConfig>(string.Format(StringPaths.ConfigSingle, "Audio", "SFXListConfig"));
|
||||
DispatcherSoundListConfig = Resources.Load<DispatcherSoundListConfig>(string.Format(StringPaths.ConfigSingle, "Audio", "DispatcherSoundListConfig"));
|
||||
EnemiesSoundListConfig = Resources.Load<EnemiesSoundListConfig>(string.Format(StringPaths.ConfigSingle, "Audio", "EnemiesSoundListConfig"));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Code.Audio;
|
||||
using Code.Gameplay.Door;
|
||||
using Code.UI.Panels.Etc;
|
||||
|
||||
@@ -36,7 +37,7 @@ namespace Code.UI.Panels
|
||||
settingButton.OnPointerExitEvent = CloseDoor;
|
||||
exitButton.OnPointerExitEvent = CloseDoor;
|
||||
|
||||
_cinematicDoorOpening = new(mainMenuUIVariables.MainMenuDoor, mainMenuUIVariables.DoorLight);
|
||||
_cinematicDoorOpening = new(mainMenuUIVariables.MainMenuDoor, mainMenuUIVariables.DoorLight);
|
||||
}
|
||||
|
||||
private void OpenStart() => _cinematicDoorOpening.PreOpen(0);
|
||||
@@ -45,6 +46,6 @@ namespace Code.UI.Panels
|
||||
|
||||
private void OpenExit() => _cinematicDoorOpening.PreOpen(2);
|
||||
|
||||
private void CloseDoor() => _cinematicDoorOpening.Close();
|
||||
private void CloseDoor() => _cinematicDoorOpening.Close();
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,83 @@
|
||||
using System;
|
||||
using Code.Audio;
|
||||
using Reflex.Attributes;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using AudioType = Code.Audio.AudioType;
|
||||
|
||||
namespace Code.UI
|
||||
{
|
||||
public class SettingsPanel : UIElement
|
||||
{
|
||||
[SerializeField] private TMP_Text scoreText;
|
||||
[SerializeField] private TMP_Text gameOverText;
|
||||
[SerializeField] private Image _background;
|
||||
|
||||
public void UpdateScoreText(int score) => scoreText.text = score.ToString();
|
||||
[SerializeField] private Slider master;
|
||||
[SerializeField] private Slider sfx;
|
||||
[SerializeField] private Slider dispatcher;
|
||||
[SerializeField] private Slider creatures;
|
||||
[SerializeField] private Slider menuMusic;
|
||||
[SerializeField] private Slider gameplayMusic;
|
||||
|
||||
[Inject] IAudioService _audioService;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
master.SetValueWithoutNotify(_audioService.GetSetting(AudioType.Master));
|
||||
master.onValueChanged.AddListener(OnMasterUpdate);
|
||||
|
||||
sfx.value = _audioService.GetSetting(AudioType.SFX);
|
||||
sfx.onValueChanged.AddListener(OnSFXUpdate);
|
||||
|
||||
dispatcher.value = _audioService.GetSetting(AudioType.DispatcherSounds);
|
||||
dispatcher.onValueChanged.AddListener(OnDispatcherUpdate);
|
||||
|
||||
creatures.value = _audioService.GetSetting(AudioType.Creatures);
|
||||
creatures.onValueChanged.AddListener(OnEnemiesUpdate);
|
||||
|
||||
menuMusic.value = _audioService.GetSetting(AudioType.MenuMusic);
|
||||
menuMusic.onValueChanged.AddListener(OnMenuMusicUpdate);
|
||||
|
||||
gameplayMusic.value = _audioService.GetSetting(AudioType.GameplayMusic);
|
||||
gameplayMusic.onValueChanged.AddListener(OnGameplayUpdate);
|
||||
}
|
||||
|
||||
private void OnMasterUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.Master, value);
|
||||
// _audioService.PlayTestClip(AudioType.Master); XDXDXDXD TODO Убрать или придумать что-нибудь
|
||||
}
|
||||
private void OnSFXUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.SFX, value);
|
||||
_audioService.PlayTestClip(AudioType.SFX);
|
||||
}
|
||||
private void OnDispatcherUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.DispatcherSounds, value);
|
||||
_audioService.PlayTestClip(AudioType.DispatcherSounds);
|
||||
}
|
||||
private void OnEnemiesUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.Creatures, value);
|
||||
_audioService.PlayTestClip(AudioType.Creatures);
|
||||
}
|
||||
private void OnMenuMusicUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.MenuMusic, value);
|
||||
_audioService.PlayTestClip(AudioType.MenuMusic);
|
||||
}
|
||||
private void OnGameplayUpdate(float value)
|
||||
{
|
||||
_audioService.ChangeSetting(AudioType.GameplayMusic, value);
|
||||
_audioService.PlayTestClip(AudioType.GameplayMusic);
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
_background.enabled = false;
|
||||
scoreText.enabled = false;
|
||||
gameOverText.enabled = false;
|
||||
base.Hide();
|
||||
}
|
||||
public override void Show()
|
||||
{
|
||||
_background.enabled = true;
|
||||
scoreText.enabled = true;
|
||||
gameOverText.enabled = true;
|
||||
base.Show();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user