Получение урона теперь чуть более заметно (плейсхолдер)
This commit is contained in:
1 parent
dd1399e015
commit
5d856ae162
38 files changed
+436053
-134
No files matched your search
@@ -42,27 +42,18 @@ namespace Code.App.AppStates
|
||||
.RegisterLoading(LoadingWork.LoadUI)
|
||||
.RegisterLoading(LoadingWork.LoadModelResource)
|
||||
.RegisterLoading(LoadingWork.LoadAudio);
|
||||
|
||||
//_playerHealth = Context.PlayerFactory.CreatePlayerHealth();
|
||||
|
||||
//_playerHealth.OnDamage += PlayerDamageTaken;
|
||||
//_playerHealth.OnDeath += EndGame;
|
||||
|
||||
Context.AudioService.TransitToSnapshot(AudioSnapshotState.None);
|
||||
|
||||
Context.InputService.EnableMap(ActionMappings.Gameplay);
|
||||
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug1, InstaKillDEBUG);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, RoomPassedDEBUG);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug5, Tube);
|
||||
Context.InputService.DebugBindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, TakeGamageDEBUG);
|
||||
|
||||
// Context.SceneLoaderService.LoadSceneAsyncAwaitable((int)SceneIds.DevGen);
|
||||
Context.SceneLoaderService.LoadSceneAsyncAwaitable((int)SceneIds.DevGen);
|
||||
Context.LoadingManager.OnLoadingEnded += AfterSceneLoaded;
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
WaitForLoad();
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
|
||||
WaitForLoad().Forget();
|
||||
}
|
||||
private async UniTask WaitForPlayerCharacterLoad() => _playerCharacter = await Context.PlayerFactory.CreatePlayer();
|
||||
|
||||
@@ -160,22 +151,27 @@ namespace Code.App.AppStates
|
||||
{
|
||||
Context.AudioService.PlayDispatcher((DispatcherSounds)Random.Range((int)DispatcherSounds.TakeDamage1,(int)DispatcherSounds.TakeDamage4));
|
||||
Context.AudioService.PlayCourier((CourierSounds)Random.Range((int)CourierSounds.Damage1,(int)CourierSounds.Damage2));
|
||||
DamageEffectProcess().Forget();
|
||||
}
|
||||
|
||||
// TODO В конфиг
|
||||
private async UniTaskVoid DamageEffectProcess()
|
||||
{
|
||||
_damagePanel.Show();
|
||||
Context.AudioService.ApplyStun(200, 0.5f);
|
||||
await UniTask.WaitForSeconds(3f);
|
||||
Context.AudioService.ApplyStun(5000, 1f);
|
||||
_damagePanel.Hide();
|
||||
}
|
||||
// DEBUG
|
||||
private void InstaKillDEBUG(InputAction.CallbackContext context)
|
||||
{
|
||||
_playerHealth.InstaKill();
|
||||
}
|
||||
private void RoomPassedDEBUG(InputAction.CallbackContext context)
|
||||
private void TakeGamageDEBUG(InputAction.CallbackContext context)
|
||||
{
|
||||
_orderService.RoomPassed();
|
||||
}
|
||||
private OrderDispenser _debugTube;
|
||||
|
||||
private void Tube(InputAction.CallbackContext context)
|
||||
{
|
||||
_debugTube.ThrowOrder();
|
||||
}
|
||||
_playerHealth.GetDamage(1);
|
||||
}
|
||||
// DEBUG
|
||||
private bool _tickEnabled;
|
||||
public override void Tick()
|
||||
@@ -217,8 +213,7 @@ namespace Code.App.AppStates
|
||||
|
||||
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug1, InstaKillDEBUG);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, RoomPassedDEBUG);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug5, Tube);
|
||||
Context.InputService.DebugUnbindAction((int)ActionMappings.Debug, (int)DebugActions.Debug4, TakeGamageDEBUG);
|
||||
|
||||
base.ExitState();
|
||||
}
|
||||
@@ -235,13 +230,15 @@ namespace Code.App.AppStates
|
||||
|
||||
private GameplayPanel _gameplayPanel;
|
||||
private ArmsMeshProvider _armsMesh;
|
||||
|
||||
private DamagePanel _damagePanel;
|
||||
private void UIInitialize()
|
||||
{
|
||||
_gameplayPanel = (GameplayPanel)Context.UIService.CurrentPanel;
|
||||
_gameplayPanel.Initialize(_playerScore, _playerHealth, _orderService);
|
||||
Context.AudioService.OnDispatcherStarted += _gameplayPanel.SummonDispatcher;
|
||||
Context.AudioService.OnDispatcherEnded += _gameplayPanel.CloseDispatcher;
|
||||
|
||||
_damagePanel = _gameplayPanel.DamagePanel;
|
||||
}
|
||||
private void MusicInitialize()
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace Code.Audio
|
||||
}
|
||||
public enum EnemiesSounds
|
||||
{
|
||||
Bastard,
|
||||
Bravo,
|
||||
GrandpaAttack,
|
||||
RoachAttack,
|
||||
RoachStep,
|
||||
GrandpaStep
|
||||
}
|
||||
|
||||
@@ -193,6 +193,10 @@ namespace Code.Audio
|
||||
_audioSourcePool
|
||||
.PlayOneShot(_audioFactory.SFXAudios[(int)sfxId], position, _audioMixerGroups[AudioType.SFX]).Forget();
|
||||
}
|
||||
public void ApplyStun(float value, float time)
|
||||
{
|
||||
_mixer.DOSetFloat("Stun", value, time);
|
||||
}
|
||||
|
||||
public void PlayEnemy(EnemiesSounds enemySoundId, Vector3 position)
|
||||
{
|
||||
|
||||
@@ -26,5 +26,6 @@ namespace Code.Audio
|
||||
AudioSource GetSourceOfGroup(AudioType group);
|
||||
void ReleaseSourceOfGroup(AudioSource source);
|
||||
void PlayCourier(CourierSounds range);
|
||||
void ApplyStun(float value, float time);
|
||||
}
|
||||
}
|
||||
@@ -188,11 +188,10 @@ namespace Code.Gameplay.Enemies
|
||||
_canAttack = false;
|
||||
_attackCooldownTimer = AttackCooldown;
|
||||
}
|
||||
|
||||
protected virtual void ApplyEffectsToPlayer()
|
||||
{
|
||||
if (PlayerController)
|
||||
PlayerController.BlockAbilities(3f);
|
||||
PlayerController.BlockAbilities(3f); // TODO в конфиг
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Code.Gameplay.Enemies
|
||||
|
||||
if (!(distance <= AttackRange)) return;
|
||||
|
||||
audioService.PlayEnemy(EnemiesSounds.Bravo,agent.transform.position);
|
||||
audioService.PlayEnemy(EnemiesSounds.RoachAttack, agent.transform.position);
|
||||
|
||||
DealDamage();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Code.Gameplay.Enemies
|
||||
|
||||
if (!(distance <= AttackRange)) return;
|
||||
|
||||
audioService.PlayEnemy(EnemiesSounds.Bastard,agent.transform.position);
|
||||
audioService.PlayEnemy(EnemiesSounds.GrandpaAttack,agent.transform.position);
|
||||
|
||||
if (Player.CustomCharacterController.IsSliding)
|
||||
ApplyStun();
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace Code.Gameplay.Enemies
|
||||
|
||||
public void PlayStep()
|
||||
{
|
||||
Debug.Log("Play Step");
|
||||
_audioSource.transform.position = transform.position;
|
||||
_audioSource.PlayOneShot(_audioFactory.EnemiesAudios[(int)stepId]);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Code.Gameplay.Orders.Order;
|
||||
using Code.Scenes;
|
||||
using Code.Scenes.SceneEnvironments;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Code.Scenes.SceneEnvironments;
|
||||
using Reflex.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -36,19 +35,10 @@ namespace Code.Generator
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// _orderService.OrderGive();
|
||||
|
||||
_spawnedRooms = new List<Room>();
|
||||
_roomIndexesStack = new();
|
||||
|
||||
Debug.LogWarning($"КОТЛЫ ГЕНЕРАЛЬСКИЕ{_orderService.DeliveryTimer}");
|
||||
|
||||
// CreateRoomsStack();
|
||||
|
||||
// SpawnInitialRoomsAsync();
|
||||
_orderService.OnOrderGiven += CreateRoomsStack;
|
||||
// RoomTrigger.PlayerEnteredRoom += OnPlayerEntered;
|
||||
|
||||
CreateInitialRoom();
|
||||
}
|
||||
|
||||
@@ -61,7 +51,6 @@ namespace Code.Generator
|
||||
Room roomToRemove = _spawnedRooms[0];
|
||||
_spawnedRooms.RemoveAt(0);
|
||||
|
||||
// _factory.ReleaseRoom(roomToRemove);
|
||||
Object.Destroy(roomToRemove.gameObject);
|
||||
}
|
||||
}
|
||||
@@ -81,16 +70,12 @@ namespace Code.Generator
|
||||
|
||||
_roomIndexesStack.Add(new(RoomType.Basic, roomIndex));
|
||||
remainingTime -= room.RoomTimer;
|
||||
Debug.Log($"комната {room.name} время {room.RoomTimer} осталось: {remainingTime}");
|
||||
}
|
||||
|
||||
AddPickupRoom();
|
||||
Debug.Log($"добавлена зона заказа");
|
||||
|
||||
AddSaveRoom();
|
||||
Debug.Log($"добавлена сейв зона");
|
||||
|
||||
Debug.Log($"стек комнат: {_roomIndexesStack.Count}");
|
||||
SpawnNextRoom();
|
||||
}
|
||||
|
||||
@@ -125,8 +110,6 @@ namespace Code.Generator
|
||||
|
||||
gameplaySceneEnvironment.playerSpawnPoint = instantiated.playerSpawn;
|
||||
instantiated.Initialize(_orderService);
|
||||
|
||||
Debug.Log($"Первая комната: {instantiated.name}");
|
||||
}
|
||||
private void SpawnNextRoom()
|
||||
{
|
||||
@@ -205,18 +188,8 @@ namespace Code.Generator
|
||||
|
||||
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(_orderService);
|
||||
|
||||
// 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;
|
||||
current.transform.rotation = Quaternion.Euler(0, segmentOriginYRotation, 0);
|
||||
current.Initialize(_orderService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Code.UI.Panels
|
||||
{
|
||||
public class DamagePanel : UIElement
|
||||
{
|
||||
[SerializeField] private Image background;
|
||||
[SerializeField] private Color shownColor;
|
||||
[SerializeField] private Color hiddenColor;
|
||||
public override void Hide()
|
||||
{
|
||||
Shown = false;
|
||||
// background.enabled = false;
|
||||
background.DOColor(hiddenColor, 2f);
|
||||
}
|
||||
public override void Show()
|
||||
{
|
||||
Shown = true;
|
||||
// background.enabled = true;
|
||||
background.DOColor(shownColor, 0.3f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b586dbc292c44261892460f578a38e50
|
||||
timeCreated: 1764769541
|
||||
@@ -26,6 +26,9 @@ namespace Code.UI.Panels
|
||||
[Header("MoneyBar")]
|
||||
[SerializeField] private TMP_Text moneyText;
|
||||
|
||||
[SerializeField] private DamagePanel damagePanel;
|
||||
public DamagePanel DamagePanel => damagePanel;
|
||||
|
||||
private void ScoreUpdate(int count, int money)
|
||||
{
|
||||
// TODO Анимация получения\потери
|
||||
|
||||
Reference in new issue
Block a user