Платформер враги, инфраструктура, герой

This commit is contained in:
ThomasCharester committed 2026-03-09 16:28:40 +03:00
1 parent 28125eb382
commit 93819c1dd3
61 files changed
+1458 -418

No files matched your search

+51 -28
View File
@@ -5,18 +5,58 @@
</component>
<component name="ChangeListManager">
<list default="true" id="7a4e4e1b-6c5f-4c8d-968e-512e90aa8c7c" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Enemies/Boar.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Enemies/Boar.cs.meta" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Enemies/BoarRadar.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Enemies/BoarRadar.cs.meta" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/EntityHealth.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/EntityHealth.cs.meta" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Generators/UIPanelEventsGenerator.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Generators/UIPanelEventsGenerator.cs.meta" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.Infra/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Infra/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/AddressableAssetsData/AssetGroups/Default Local Group.asset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Enemies/Boar.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Enemies/Boar.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Entity.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/Entity.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlatformerEnemyFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlatformerEnemyFactory.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlayerEntity.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/Entity/PlayerEntity.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Platformer/PlatformerState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Platformer/PlatformerState.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Race/Racer/Player/PlayerCarInput.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Race/Racer/Player/PlayerCarInput.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Race/UI/PlayerScoreCounter.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Race/UI/PlayerScoreCounter.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Race/UI/PlayerScores.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Race/UI/PlayerScores.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Example/Race/UI/WinScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Example/Race/UI/WinScreen.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/PapaInstaller.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/PapaInstaller.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/BootstrapState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/BootstrapState.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/GameplayState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/GameplayState.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/MainMenuState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/MainMenuState.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Configs/LayerMaskType.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Configs/LayerMaskType.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/Input/ActionMappings.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/Input/ActionMappings.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/SceneLoader/ScenesAssetReferences.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/SceneLoader/ScenesAssetReferences.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/DamnEmptyPanel.cs" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/DamnEmptyPanel.cs.meta" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/LoadingPanel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/LoadingPanel.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/LogoPanel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/LogoPanel.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/MenuChoosePanel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/Panels/MenuChoosePanel.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIFactory.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIFactory.cs.meta" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIPanel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIPanel.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIPanelSettings.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIPanelSettings.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIService.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIService.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Code/Infrastructure/UI/UIService.cs.meta" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/InputSystem_Actions.inputactions" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/InputSystem_Actions.inputactions" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources/Example/Platformer/Characters/Player/Attack.anim" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources/Example/Platformer/Characters/Player/Attack.anim" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources/Example/Platformer/Characters/Player/Player.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources/Example/Platformer/Characters/Player/Player.prefab" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources/Example/Platformer/Characters/Player/PlayerPlatformer.controller" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources/Example/Platformer/Characters/Player/PlayerPlatformer.controller" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources/UI/Fonts/Bebas Neue Cyrillic SDF.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources/UI/Fonts/Bebas Neue Cyrillic SDF.asset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/DebugClassConfig.asset" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/DebugClassConfig.asset.meta" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Boar.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Boar.prefab" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Platformer.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Platformer.unity" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Settings/UniversalRenderPipelineGlobalSettings.asset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Packages/manifest.json" beforeDir="false" afterPath="$PROJECT_DIR$/Packages/manifest.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Packages/packages-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/Packages/packages-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ProjectSettings/ProjectVersion.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ProjectSettings/ProjectVersion.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Snail.prefab" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Resources_moved/Example/Platformer/Snail.prefab" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/ScenesAssetReferences.asset" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/Resources_moved/ScenesAssetReferences.asset.meta" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.App.AppStateMachine.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.Camera.CameraStateMachine.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/Code.Infrastructure.Camera.CameraStateMachine.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/ConfigLocator.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/PlatformerEnemySettingsConfig.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/PlatformerEnemySettingsConfig.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/SystemConfigsReferences.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Assets/UnityCodeGen.Generated/UIPanelSettingsConfig.Generated.cs.meta" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -124,7 +164,9 @@
<workItem from="1770451319773" duration="10815000" />
<workItem from="1770634886406" duration="8191000" />
<workItem from="1771758321259" duration="9067000" />
<workItem from="1772187561867" duration="1279000" />
<workItem from="1772187561867" duration="2127000" />
<workItem from="1773044760422" duration="3994000" />
<workItem from="1773048811603" duration="11294000" />
</task>
<servers />
</component>
@@ -141,23 +183,4 @@
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/Assets/Code/Infrastructure/App/States/MainMenuState.cs</url>
<line>58</line>
<properties documentPath="A:\Projects\Infra\Assets\Code\Infrastructure\App\States\MainMenuState.cs" containingFunctionPresentation="Method 'OnReadyToPlay'">
<startOffsets>
<option value="2072" />
</startOffsets>
<endOffsets>
<option value="2131" />
</endOffsets>
</properties>
<option name="timeStamp" value="15" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project>
@@ -171,6 +171,12 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 69e720c0a88f4f9499af76a887cd9fdf
m_Address: Assets/Resources_moved/Example/Platformer/Configs/LayerMasks/Player.asset
m_ReadOnly: 0
m_SerializedLabels:
- LayerMaskConfig
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 6a86e03165bcd491ba987514d0da38bd
m_Address: Assets/Resources_moved/Configs/Audio/Infos/UI/launchSelect1.asset
m_ReadOnly: 0
@@ -236,11 +242,6 @@ MonoBehaviour:
m_SerializedLabels:
- AudioInfoConfig
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: a78f552da8f156b469b95652e4b0209d
m_Address: DebugClassConfig
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: a9d36f968917dc35cb0e534af9ea6e59
m_Address: Assets/Resources_moved/Configs/Audio/Infos/UI/launchSelectMenu.asset
m_ReadOnly: 0
@@ -278,17 +279,18 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: cc76fd76d78cd364880ebe8330a05834
m_Address: Assets/Resources_moved/Example/Platformer/Configs/LayerMasks/Enemies.asset
m_ReadOnly: 0
m_SerializedLabels:
- LayerMaskConfig
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: d2750e654bd192d41a48144c43b41302
m_Address: Assets/Resources_moved/Configs/UI/Logo.asset
m_ReadOnly: 0
m_SerializedLabels:
- UIPanelConfig
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: d54fabdcc748a594aa0551dcd235c7c2
m_Address: ScenesAssetReferences
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: d7dd69cfadda3d6e18ec390724be0d80
m_Address: Assets/Resources_moved/Configs/Audio/AudioSourcePrefabConfig.asset
m_ReadOnly: 0
@@ -13,14 +13,15 @@ namespace Code.Example.Platformer.Entity.Enemies
protected override void Move()
{
if (_target)
{
_directionRight = (transform.position - _target.position).magnitude < float.Epsilon;
_directionRight = ((_target.position - transform.position)).x > float.Epsilon;
UnityEngine.Debug.DrawLine(transform.position, (transform.position + (_target.position - transform.position)), Color.salmon);
CheckupDirection();
rigidbody2D.linearVelocityX = _directionRight ? 0.5f : -0.5f;
rigidbody2D.linearVelocity *= _acceleration;
rigidbody2D.linearVelocityX *= _acceleration;
}
else
{
@@ -15,6 +15,15 @@ namespace Code.Example.Platformer.Entity
[SerializeField] protected SpriteRenderer spriteRenderer;
[SerializeField] private Vector2 groundPoint;
private EntityHealth _health;
private PlatformerEntityData _data;
public void SetData(PlatformerEntityData data)
{
_data = data;
_health = new(data.maxHealth);
}
protected bool onGround;
protected virtual void Update()
@@ -29,7 +38,9 @@ namespace Code.Example.Platformer.Entity
{
onGround = CheckGround();
animator.SetBool(OnGround, onGround);
Move();
if(rigidbody2D.linearVelocity.x is > 0.01f or < -0.01f) HandleFlipX();
}
@@ -40,5 +51,7 @@ namespace Code.Example.Platformer.Entity
}
protected abstract void Move();
public virtual void GetDamage(int damage) => _health.GiveDamage(damage);
}
}
@@ -0,0 +1,27 @@
namespace Code.Example.Platformer.Entity
{
public class EntityHealth
{
private int _health, _maxHealth;
public bool IsDead { get; private set; }
public EntityHealth(int initialHealth)
{
_health = initialHealth;
}
public void GiveDamage(int damage)
{
_health -= damage;
if(_health <= 0) IsDead = true;
}
public void Heal(int heal)
{
if (IsDead) return;
if (_health + heal > _maxHealth) _health = _maxHealth;
else _health += heal;
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a3078030faef42b5bddd46a7c5c91d95
timeCreated: 1773058870
@@ -1,32 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Code.Infrastructure.Configs;
using Code.Infrastructure.EventBus;
using Code.Infrastructure.Generators;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
namespace Code.Example.Platformer.Entity
{
[Config("Configs/Gameplay/Platformer/EnemySettings", true)]
public class PlatformerEnemySettings
[Config("Configs/Gameplay/Platformer/EntitySettings", true)]
public class PlatformerEntitySettings
{
[ToConfig] public PlatformerEnemyData racerData;
[ToConfig] public PlatformerEntityData EntityData;
[ToConfig] public AssetReference prefabReference;
}
[Serializable]
public struct PlatformerEnemyData
public struct PlatformerEntityData
{
public string name;
public float speed;
public float acceleration;
public int damage;
public PlatformerEnemyType type;
public PlatformerEntityType type;
public int maxHealth;
}
public enum PlatformerEnemyType
public enum PlatformerEntityType
{
Dummy
Player,
Boar,
Bee,
Snail
}
public class PlatformerEnemyFactory
{
private EventBus _eventBus;
private string _enemyConfigsLabel;
private AsyncOperationHandle<IList<PlatformerEntitySettingsConfig>> _enemyConfigsHandle;
private Dictionary<PlatformerEntityType, AsyncOperationHandle<GameObject>> _enemyPrefabsHandle = new();
private Dictionary<PlatformerEntityType, PlatformerEntitySettingsConfig> _enemyConfigs;
public PlatformerEnemyFactory(IConfigLocator configLocator, EventBus eventBus)
{
_eventBus = eventBus;
_enemyConfigsLabel = configLocator.TryGetManyConfigAssetReferences<PlatformerEntitySettingsConfig>();
LoadConfigs().Forget();
}
private async UniTaskVoid LoadConfigs()
{
_enemyConfigsHandle = Addressables.LoadAssetsAsync<PlatformerEntitySettingsConfig>(_enemyConfigsLabel);
await _enemyConfigsHandle.ToUniTask();
_enemyConfigs = _enemyConfigsHandle.Result.ToDictionary(x => x.racerData.type);
_enemyConfigs.Remove(PlatformerEntityType.Player);
_eventBus.RaiseEvent<IPlatformerFactoryInitializedHandle>(x => x.PlatformerFactoryInitialized());
}
public async UniTaskVoid LoadRacer(PlatformerEntityType racerType)
{
if (racerType == PlatformerEntityType.Player) return;
if (_enemyPrefabsHandle.ContainsKey(racerType))
{
_eventBus.RaiseEvent<IPlatformerEnemyLoadedHandle>(x => x.PlatformerEnemyLoaded(racerType, null));
return;
}
UnityEngine.Debug.LogWarning($"Racer loaded {racerType}");
_enemyPrefabsHandle.Add(racerType,
Addressables.LoadAssetAsync<GameObject>(_enemyConfigs[racerType].prefabReference));
await _enemyPrefabsHandle[racerType].ToUniTask();
var racer = _enemyPrefabsHandle[racerType].Result.GetComponent<Entity>();
racer.SetData(_enemyConfigs[racerType].racerData);
_eventBus.RaiseEvent<IPlatformerEnemyLoadedHandle>(x => x.PlatformerEnemyLoaded(racerType, racer));
}
public void ReleaseRacer(PlatformerEntityType racerType)
{
_enemyPrefabsHandle[racerType].Release();
_enemyPrefabsHandle.Remove(racerType);
}
public void Dispose()
{
UnityEngine.Debug.LogWarning($"Racers released");
foreach (var prefab in _enemyPrefabsHandle)
prefab.Value.Release();
_enemyPrefabsHandle.Clear();
_enemyConfigsHandle.Release();
}
}
public interface IPlatformerFactoryInitializedHandle : IGlobalSubscriber
{
public void PlatformerFactoryInitialized();
}
public interface IPlatformerEnemyLoadedHandle : IGlobalSubscriber
{
public void PlatformerEnemyLoaded(PlatformerEntityType type, Entity entity);
}
}
@@ -1,4 +1,6 @@
using System;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Configs;
using Code.Infrastructure.Input;
using Reflex.Attributes;
using UnityEngine;
@@ -8,34 +10,48 @@ namespace Code.Example.Platformer.Entity
{
public class PlayerEntity : Entity
{
private static readonly int OnAttack = Animator.StringToHash("OnAttack");
private IInputService _inputService;
[Inject]
private void Construct(IInputService inputService)
private void Construct(IInputService inputService, IAudioService audioService)
{
_audioService = audioService;
_inputService = inputService;
_inputService.BindActionPerformed((int)ActionMappings.Gameplay, (int)GameplayActions.Move,
_inputService.BindActionPerformed((int)ActionMappings.Platformer, (int)PlatformerActions.Move,
MovementPerformed);
_inputService.BindActionCancelled((int)ActionMappings.Gameplay, (int)GameplayActions.Move,
_inputService.BindActionCancelled((int)ActionMappings.Platformer, (int)PlatformerActions.Move,
MovementCancelled);
_inputService.BindActionPerformed((int)ActionMappings.Gameplay, (int)GameplayActions.Brake, JumpPerformed);
_inputService.BindActionPerformed((int)ActionMappings.Platformer, (int)PlatformerActions.Jump, JumpPerformed);
_inputService.BindActionPerformed((int)ActionMappings.Platformer, (int)PlatformerActions.Attack, AttackPerformed);
_inputService.BindActionPerformed((int)ActionMappings.Platformer, (int)PlatformerActions.Sprint, SprintPerformed);
_inputService.BindActionCancelled((int)ActionMappings.Platformer, (int)PlatformerActions.Sprint, SprintCancelled);
//cameraFactory.GetCinematicCamera(CameraMode.Platformer).Follow = transform; , CameraFactory cameraFactory
}
private void OnDestroy()
{
_inputService.UnbindActionPerformed((int)ActionMappings.Gameplay, (int)GameplayActions.Move,
_inputService.UnbindActionPerformed((int)ActionMappings.Platformer, (int)PlatformerActions.Move,
MovementPerformed);
_inputService.UnbindActionCancelled((int)ActionMappings.Gameplay, (int)GameplayActions.Move,
_inputService.UnbindActionCancelled((int)ActionMappings.Platformer, (int)PlatformerActions.Move,
MovementCancelled);
_inputService.UnbindActionPerformed((int)ActionMappings.Gameplay, (int)GameplayActions.Brake, JumpPerformed);
_inputService.UnbindActionPerformed((int)ActionMappings.Platformer, (int)PlatformerActions.Jump, JumpPerformed);
_inputService.UnbindActionPerformed((int)ActionMappings.Platformer, (int)PlatformerActions.Attack, AttackPerformed);
_inputService.UnbindActionPerformed((int)ActionMappings.Platformer, (int)PlatformerActions.Sprint, SprintPerformed);
_inputService.UnbindActionCancelled((int)ActionMappings.Platformer, (int)PlatformerActions.Sprint, SprintCancelled);
}
private float _acceleration = 1f;
protected override void Move()
{
rigidbody2D.linearVelocityX = _moveDirection.x * 5f;
rigidbody2D.linearVelocityX = _moveDirection.x * 2f * _acceleration;
}
private Vector2 _moveDirection;
private IAudioService _audioService;
private void MovementPerformed(InputAction.CallbackContext callbackContext) =>
_moveDirection = callbackContext.ReadValue<Vector2>();
@@ -46,7 +62,48 @@ namespace Code.Example.Platformer.Entity
private void JumpPerformed(InputAction.CallbackContext callbackContext)
{
if (!onGround) return;
rigidbody2D.AddForceY(100f);
rigidbody2D.AddForceY(150f);
_acceleration = 1f;
}
[SerializeField] private Vector2 attackOffset;
private void AttackPerformed(InputAction.CallbackContext callbackContext)
{
if (!onGround) return;
//
//
_audioService.PlayOneShot(AudioNames.UISounds, 1);
animator.SetBool(OnAttack, true);
}
public void CastAttack()
{
var damagedOnes =
Physics2D.OverlapPointAll((Vector2)transform.position + attackOffset, LayerMasks.Masks[LayerMaskType.PlatformerEnemy]);
if (damagedOnes == null) return;
foreach (var damaged in damagedOnes)
{
damaged.gameObject.GetComponent<Entity>().GetDamage(1);
_audioService.PlayOneShot(AudioNames.UISounds, 2);
}
}
private void SprintPerformed(InputAction.CallbackContext callbackContext)
{
if (!onGround) return;
//
_acceleration = 3f;
}
private void SprintCancelled(InputAction.CallbackContext callbackContext)
{
_acceleration = 1f;
}
public void AttackEnd() => animator.SetBool(OnAttack, false);
}
}
@@ -30,7 +30,7 @@ namespace Code.Example.Platformer
Context.UIService.OpenPanel(UIPanelType.Loading);
Context.SceneLoader.LoadSceneAsync(SceneId.Platformer, LoadSceneMode.Single).Forget();
Context.InputService.EnableMap(ActionMappings.Gameplay);
Context.InputService.EnableMap(ActionMappings.Platformer);
Context.CameraFactory.LoadCinemachineCamera(CameraMode.Platformer).Forget();
}
private Loading _loading;
@@ -45,7 +45,7 @@ namespace Code.Example.Platformer
protected override void OnExitState()
{
Context.CameraFactory.ReleaseCinemachineCamera(CameraMode.Platformer);
Context.InputService.DisableMap(ActionMappings.Gameplay);
Context.InputService.DisableMap(ActionMappings.Platformer);
EventBus.Unsubscribe(this);
}
@@ -15,10 +15,10 @@ namespace Code.Example.Race.Racer.Player
public void Construct(IInputService inputService)
{
_inputService = inputService;
_inputService.BindActionPerformed((int)ActionMappings.Gameplay, (int)GameplayActions.Move, MovementPerformed);
_inputService.BindActionCancelled((int)ActionMappings.Gameplay, (int)GameplayActions.Move, MovementEnded);
_inputService.BindActionPerformed((int)ActionMappings.Gameplay, (int)GameplayActions.Brake, BrakePerformed);
_inputService.BindActionCancelled((int)ActionMappings.Gameplay, (int)GameplayActions.Brake, BrakeEnded);
_inputService.BindActionPerformed((int)ActionMappings.Race, (int)RaceActions.Move, MovementPerformed);
_inputService.BindActionCancelled((int)ActionMappings.Race, (int)RaceActions.Move, MovementEnded);
_inputService.BindActionPerformed((int)ActionMappings.Race, (int)RaceActions.Brake, BrakePerformed);
_inputService.BindActionCancelled((int)ActionMappings.Race, (int)RaceActions.Brake, BrakeEnded);
}
private void MovementPerformed(InputAction.CallbackContext context) => MovementInput = context.ReadValue<Vector2>();
@@ -32,10 +32,10 @@ namespace Code.Example.Race.Racer.Player
private void OnDestroy()
{
if (_inputService == null) return;
_inputService.UnbindActionPerformed((int)ActionMappings.Gameplay, (int)GameplayActions.Move, MovementPerformed);
_inputService.UnbindActionCancelled((int)ActionMappings.Gameplay, (int)GameplayActions.Move, MovementEnded);
_inputService.UnbindActionPerformed((int)ActionMappings.Gameplay, (int)GameplayActions.Brake, BrakePerformed);
_inputService.UnbindActionCancelled((int)ActionMappings.Gameplay, (int)GameplayActions.Brake, BrakeEnded);
_inputService.UnbindActionPerformed((int)ActionMappings.Race, (int)RaceActions.Move, MovementPerformed);
_inputService.UnbindActionCancelled((int)ActionMappings.Race, (int)RaceActions.Move, MovementEnded);
_inputService.UnbindActionPerformed((int)ActionMappings.Race, (int)RaceActions.Brake, BrakePerformed);
_inputService.UnbindActionCancelled((int)ActionMappings.Race, (int)RaceActions.Brake, BrakeEnded);
}
}
}
@@ -8,7 +8,7 @@ using UnityEngine;
namespace Code.Example.Race.UI
{
public class PlayerScoreCounter : UIPanel, IScoreChangedHandle
public partial class PlayerScoreCounter : UIPanel, IScoreChangedHandle
{
[SerializeField] private TMP_Text playerScore;
private EventBus _eventBus;
+1 -1
View File
@@ -8,7 +8,7 @@ using UnityEngine.UI;
namespace Code.Example.Race.UI
{
public class PlayerScores : UIPanel
public partial class PlayerScores : UIPanel
{
[SerializeField] private Image image;
[SerializeField] private TMP_Text scoreText;
+1 -1
View File
@@ -7,7 +7,7 @@ using UnityEngine.UI;
namespace Code.Example.Race.UI
{
public class WinScreen : UIPanel
public partial class WinScreen : UIPanel
{
[SerializeField] private Image image;
[SerializeField] private TMP_Text winText;
+17 -21
View File
@@ -6,6 +6,7 @@ using Code.Infrastructure.Input;
using Code.Infrastructure.Loadings;
using Code.Infrastructure.SceneLoader;
using Code.Infrastructure.UI;
using Code.Infrastructure.UI.Panels;
using Code.Infrastructure.Volume;
using Reflex.Core;
using Reflex.Enums;
@@ -23,7 +24,8 @@ namespace Code.Infrastructure.App
IInputServiceInitializedHandle,
ICameraInitializedHandle,
IUIInitializedHandle,
IUIPanelLoaded,
ILoadingPanelCreatedHandle,
ILogoPanelCreatedHandle,
IVolumesInitializedHandle,
IVolumeLoaded,
IAudioSourcePoolInitializedHandle,
@@ -151,26 +153,8 @@ namespace Code.Infrastructure.App
_ui2CamLoading.DoProgress();
_initialLoading.DoProgress();
_thatRightContainer.Resolve<IUIService>().TryLoadPanel(UIPanelType.Logo);
_thatRightContainer.Resolve<IUIService>().TryLoadPanel(UIPanelType.Loading);
}
public void UILoaded(UIPanelType uiPanelType)
{
switch (uiPanelType)
{
case UIPanelType.Logo:
_thatRightContainer.Resolve<IUIService>().OpenPanel(UIPanelType.Logo);
_initialLoading.DoProgress();
break;
case UIPanelType.Loading:
// _thatRightContainer.Resolve<IUIService>().OpenPanel(UIPanelType.Logo);
break;
default:
Application.Quit();
break;
}
_thatRightContainer.Resolve<IUIService>().TryLoadCreatePanel(UIPanelType.Logo);
_thatRightContainer.Resolve<IUIService>().TryLoadCreatePanel(UIPanelType.Loading);
}
public void VolumesInitialized()
@@ -212,5 +196,17 @@ namespace Code.Infrastructure.App
{
_initialLoading.DoProgress();
}
public void LoadingPanelCreated(UIPanel panel)
{
_thatRightContainer.Resolve<IUIService>().OpenPanel(UIPanelType.Logo);
_initialLoading.DoProgress();
}
public void LogoPanelCreated(UIPanel panel)
{
}
}
}
@@ -1,14 +1,13 @@
using System.Threading;
using Code.Debug;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Generators;
using Code.Infrastructure.UI;
using Code.Infrastructure.UI.Panels;
namespace Code.Infrastructure.App.States
{
[State(typeof(AppStates),typeof(AppStateMachineContext))]
[StateRaisingEvent]
public partial class BootstrapState : IUIPanelLoaded, IReadyToPlayHandle
public partial class BootstrapState : IReadyToPlayHandle, IMenuChoosePanelCreatedHandle
{
private EventBus.EventBus _eventBus;
public BootstrapState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
@@ -23,7 +22,7 @@ namespace Code.Infrastructure.App.States
Context.UIService.TryRemovePanel(UIPanelType.Logo);
Context.UIService.TryLoadPanel(UIPanelType.DebugSceneChooser);
Context.UIService.TryLoadCreatePanel(UIPanelType.DebugSceneChooser);
Context.AudioFactory.LoadAudioClips(AudioNames.UISounds);
}
@@ -34,15 +33,15 @@ namespace Code.Infrastructure.App.States
_eventBus.Unsubscribe(this);
}
public void UILoaded(UIPanelType uiPanelType)
{
if (uiPanelType != UIPanelType.DebugSceneChooser) return;
Context.UIService.OpenPanel(uiPanelType);
}
public void OnReadyToPlay(AudioNames groupName)
{
Context.AudioService.PlayRepeatedly(AudioNames.UISounds,0);
}
public void MenuChoosePanelCreated(UIPanel panel)
{
panel.gameObject.SetActive(true);
panel.Open();
}
}
}
@@ -18,7 +18,7 @@ using Reflex.Core;
using Reflex.Injectors;
using Unity.Cinemachine;
using UnityEngine.SceneManagement;
// Ивенты создания панелей сломаны TODO
namespace Code.Infrastructure.App.States
{
[State(typeof(AppStates), typeof(AppStateMachineContext))]
@@ -27,7 +27,6 @@ namespace Code.Infrastructure.App.States
IOnGameplaySceneLoadedHandler,
IRaceGameHandle,
IRacerFactoryInitializedHandle,
IUIPanelLoaded,
ICinematicMachineHandle
{
public GameplayState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context, eventBus)
@@ -52,11 +51,11 @@ namespace Code.Infrastructure.App.States
// CinemachineCamera
_gameplayLoading = new Loading(7, GameplayLoadingCompleted);
Context.UIService.TryLoadPanel(UIPanelType.PlayerScoreCounter);
Context.UIService.TryLoadPanel(UIPanelType.WinScreen);
Context.UIService.TryLoadPanel(UIPanelType.PlayerScores);
Context.UIService.TryLoadCreatePanel(UIPanelType.PlayerScoreCounter);
Context.UIService.TryLoadCreatePanel(UIPanelType.WinScreen);
Context.UIService.TryLoadCreatePanel(UIPanelType.PlayerScores);
Context.SceneLoader.LoadSceneAsync(SceneId.Gameplay, LoadSceneMode.Single).Forget();
Context.InputService.EnableMap(ActionMappings.Gameplay);
Context.InputService.EnableMap(ActionMappings.Race);
Context.CameraFactory.LoadCinemachineCamera(CameraMode.ThirdPerson).Forget();
}
@@ -85,7 +84,7 @@ namespace Code.Infrastructure.App.States
Context.UIService.TryRemovePanel(UIPanelType.WinScreen);
Context.UIService.TryRemovePanel(UIPanelType.PlayerScores);
Context.CameraFactory.ReleaseCinemachineCamera(CameraMode.ThirdPerson);
Context.InputService.DisableMap(ActionMappings.Gameplay);
Context.InputService.DisableMap(ActionMappings.Race);
_raceGame = null;
@@ -120,7 +119,7 @@ namespace Code.Infrastructure.App.States
public void RaceGameEnded(RaceScores scores)
{
var winScreen = (WinScreen)Context.UIService.TryGetPanel(UIPanelType.WinScreen);
var winScreen = (WinScreen)Context.UIService.TryGetSinglePanel(UIPanelType.WinScreen);
var id = 0;
var cachedScores = scores.GetScores();
@@ -133,7 +132,7 @@ namespace Code.Infrastructure.App.States
var winText = $@"{id} МЕСТО\n";
winScreen.SetText(winText);
var getPanel = Context.UIService.TryGetPanel(UIPanelType.PlayerScores);
var getPanel = Context.UIService.TryGetSinglePanel(UIPanelType.PlayerScores);
((PlayerScores)getPanel)
.SetText(UNTILTHEYFIXCONTAINERS.Resolve<PlayerPrefsRacePoopshitter>().GetRaces());
Context.UIService.ClosePanel(UIPanelType.PlayerScoreCounter);
@@ -176,5 +175,14 @@ namespace Code.Infrastructure.App.States
}
public void CinemachineLoaded(CinemachineCamera cinemachineCamera) => _gameplayLoading.DoProgress();
public void UISinglePanelLoaded(UIPanelType uiPanelType)
{
}
public void UISinglePanelRemoved(UIPanelType uiPanelType)
{
throw new System.NotImplementedException();
}
}
}
@@ -12,7 +12,7 @@ namespace Code.Infrastructure.App.States
{
[State(typeof(AppStates),typeof(AppStateMachineContext))]
[StateRaisingEvent]
public partial class MainMenuState : IUIPanelLoaded, IReadyToPlayHandle, IOnMainMenuSceneLoadedHandler
public partial class MainMenuState : IReadyToPlayHandle, IOnMainMenuSceneLoadedHandler, IMenuChoosePanelCreatedHandle
{
public MainMenuState(AppStateMachineContext context, EventBus.EventBus eventBus) : base(context,eventBus)
{
@@ -26,7 +26,7 @@ namespace Code.Infrastructure.App.States
_loading = new Loading(2, LoadComplete);
Context.UIService.TryLoadPanel(UIPanelType.DebugSceneChooser);
Context.UIService.TryLoadCreatePanel(UIPanelType.DebugSceneChooser);
// Context.AudioFactory.LoadAudioClips(AudioNames.UISounds);
Context.SceneLoader.LoadSceneAsync(SceneId.MainMenu, LoadSceneMode.Single).Forget();
Context.AudioService.PlayRepeatedly(AudioNames.UISounds,0);
@@ -39,14 +39,6 @@ namespace Code.Infrastructure.App.States
EventBus.Unsubscribe(this);
}
public void UILoaded(UIPanelType uiPanelType)
{
if (uiPanelType != UIPanelType.DebugSceneChooser) return;
Context.UIService.OpenPanel(uiPanelType);
_loading.DoProgress();
}
private void LoadComplete()
{
Context.UIService.OpenPanel(UIPanelType.DebugSceneChooser);
@@ -68,5 +60,13 @@ namespace Code.Infrastructure.App.States
{
}
public void MenuChoosePanelCreated(UIPanel panel)
{
panel.gameObject.SetActive(true);
panel.Open();
_loading.DoProgress();
}
}
}
@@ -2,6 +2,8 @@ namespace Code.Infrastructure.Configs
{
public enum LayerMaskType
{
PlatformerGround
PlatformerGround,
PlatformerEnemy,
PlatformerPlayer
}
}
@@ -0,0 +1,71 @@
#if UNITY_EDITOR
using Code.Infrastructure.UI;
using UnityCodeGen;
using UnityEditor;
namespace Code.Infrastructure.Generators
{
[Generator]
public class UIPanelEventsGenerator : ICodeGenerator
{
public void Execute(GeneratorContext context)
{
GenerateStates(context);
}
private void GenerateStates(GeneratorContext context)
{
var states = TypeCache.GetTypesDerivedFrom<UIPanel>();
foreach (var st in states)
{
var fireStatesCode = $@"
public override void FireCreatedEvent()
{{
_eventBus.RaiseEvent<I{st.Name}CreatedHandle>(h => h.{st.Name}Created(this));
}}
public override void FireRemovedEvent()
{{
_eventBus.RaiseEvent<I{st.Name}RemovedHandle>(h => h.{st.Name}Removed());
}}
";
var fireStatesInterfacesCode = $@"
public interface I{st.Name}CreatedHandle : IGlobalSubscriber
{{
void {st.Name}Created(UIPanel panel);
}}
public interface I{st.Name}RemovedHandle : IGlobalSubscriber
{{
void {st.Name}Removed();
}}
";
var statesCode = $@"
// retard-generated
using Code.Infrastructure.UI;
using Code.Infrastructure.EventBus;
using Code.Infrastructure.StateMachine;
namespace {st.Namespace}
{{
public partial class {st.Name}
{{
{fireStatesCode}
}}
{fireStatesInterfacesCode}
}}
";
context.AddCode($"{st.FullName}Events.Generated.cs", statesCode);
}
}
}
}
#endif
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e534143b792f4c2692451b19fb9b7e98
timeCreated: 1773046409
@@ -3,14 +3,22 @@ namespace Code.Infrastructure.Input
public enum ActionMappings
{
MainMenu,
Gameplay,
Race,
Platformer,
Debug
}
public enum GameplayActions
public enum RaceActions
{
Move,
Brake,
}
public enum PlatformerActions
{
Move,
Jump,
Attack,
Sprint,
}
public enum DebugActions
{
Debug1,
@@ -1,11 +1,9 @@
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Code.Infrastructure.SceneLoader
{
[CreateAssetMenu(fileName = "ScenesAssetReferences", menuName = "Configs/ScenesAssetReferences")]
public class ScenesAssetReferences : ScriptableObject
{
public AssetReference gameplaySceneReference;
}
}
@@ -1,17 +0,0 @@
using System;
namespace Code.Infrastructure.UI.Panels
{
public class DamnEmptyPanel : UIPanel
{
public override void Open(Action callback = null)
{
callback?.Invoke();
}
public override void Close(Action callback = null)
{
callback?.Invoke();
}
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: ce4e618236c441ca857ad458fa13e09d
timeCreated: 1769347387
@@ -5,7 +5,7 @@ using UnityEngine.UI;
namespace Code.Infrastructure.UI.Panels
{
public class LoadingPanel : UIPanel
public partial class LoadingPanel : UIPanel
{
[SerializeField] private RawImage image;
[SerializeField] private Color shownColor;
@@ -5,7 +5,7 @@ using UnityEngine.UI;
namespace Code.Infrastructure.UI.Panels
{
public class LogoPanel : UIPanel
public partial class LogoPanel : UIPanel
{
[SerializeField] private Image image;
[SerializeField] private Color shownColor;
@@ -6,7 +6,7 @@ using UnityEngine;
namespace Code.Infrastructure.UI.Panels
{
public class MenuChoosePanel : UIPanel
public partial class MenuChoosePanel : UIPanel
{
[Inject] IAudioService _audioService;
[SerializeField] private SceneChooser sceneChooser;
+6 -3
View File
@@ -12,14 +12,16 @@ namespace Code.Infrastructure.UI
{
public interface IUIFactory
{
UniTaskVoid LoadPanel(UIPanelType panelType);
UniTaskVoid LoadPanel(UIPanelType panelType, Transform parent = null);
void ReleasePanel(UIPanel panel);
Canvas Canvas { get; }
bool CheckIsMultiple(UIPanelType panelType);
}
public class UIFactory : IDisposable, IUIFactory
{
private Dictionary<UIPanelType, UIPanelSettingsConfig> _configs;
public bool CheckIsMultiple(UIPanelType panelType) => _configs[panelType].Multiple;
private AssetReference _canvasConfigReference;
private string _configsLabel;
private EventBus.EventBus _eventBus;
@@ -41,9 +43,9 @@ namespace Code.Infrastructure.UI
LoadConfigs().Forget();
}
public async UniTaskVoid LoadPanel(UIPanelType panelType)
public async UniTaskVoid LoadPanel(UIPanelType panelType, Transform parent = null)
{
var panel = (await Addressables.InstantiateAsync(_configs[panelType].Prefab, _canvas.transform).ToUniTask())
var panel = (await Addressables.InstantiateAsync(_configs[panelType].Prefab, parent ?? _canvas.transform).ToUniTask())
.GetComponent<UIPanel>();
UnityEngine.Debug.LogWarning($"Panel loaded {panelType}");
@@ -90,5 +92,6 @@ namespace Code.Infrastructure.UI
public interface IUIPanelLoadedHandle : IGlobalSubscriber
{
void UIPanelLoaded(UIPanel panel, UIPanelType panelType);
List<UIPanel> TryGetMultiplePanels(UIPanelType panelType);
}
}
@@ -1,3 +1,2 @@
fileFormatVersion: 2
guid: 8447b81247b24f1b869b0067aeeff0b8
timeCreated: 1768979324
+8
View File
@@ -1,13 +1,21 @@
using System;
using Reflex.Attributes;
using UnityEngine;
namespace Code.Infrastructure.UI
{
public abstract class UIPanel : MonoBehaviour
{
public UIPanelType PanelType { get; set; }
[SerializeField] protected bool injectMeSenpai;
public bool InjectMeSenpai => injectMeSenpai;
[Inject] protected EventBus.EventBus _eventBus;
public abstract void Open(Action callback = null);
public abstract void Close(Action callback = null);
public virtual void FireCreatedEvent(){}
public virtual void FireRemovedEvent(){}
}
}
@@ -8,6 +8,7 @@ namespace Code.Infrastructure.UI
{
[ToConfig] public AssetReference Prefab;
[ToConfig] public UIPanelType UIPanelType;
[ToConfig] public bool Multiple;
}
[Config("Configs/UI/CanvasSettings")]
+75 -18
View File
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Code.Infrastructure.EventBus;
using Reflex.Core;
using Reflex.Extensions;
using Reflex.Injectors;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Code.Infrastructure.UI
@@ -12,15 +14,18 @@ namespace Code.Infrastructure.UI
{
void OpenPanel(UIPanelType uiPanelType);
void ClosePanel(UIPanelType uiPanelType);
void TryLoadPanel(UIPanelType uiPanelType);
void TryLoadCreatePanel(UIPanelType uiPanelType, Transform parent = null);
void TryRemovePanel(UIPanelType uiPanelType);
void SetCanvasCamera(UnityEngine.Camera camera);
UIPanel TryGetPanel(UIPanelType panelType);
UIPanel TryGetSinglePanel(UIPanelType panelType);
void TryRemovePanel(UIPanel panel);
}
// Крайне неудобно пользоваться
public class UIService : IUIPanelLoadedHandle, IUIService
{
private Dictionary<UIPanelType, UIPanel> _loadedPanels = new();
private Dictionary<UIPanelType, UIPanel> _loadedSinglePanels = new();
private Dictionary<UIPanelType, List<UIPanel>> _loadedMultiplePanels = new();
private EventBus.EventBus _eventBus;
private IUIFactory _factory;
@@ -40,49 +45,101 @@ namespace Code.Infrastructure.UI
public void OpenPanel(UIPanelType uiPanelType)
{
_loadedPanels[uiPanelType].gameObject.SetActive(true);
_loadedPanels[uiPanelType].Open();
_loadedSinglePanels[uiPanelType].gameObject.SetActive(true);
_loadedSinglePanels[uiPanelType].Open();
}
// TODO Close event
public void ClosePanel(UIPanelType uiPanelType)
{
_loadedPanels[uiPanelType].Close(() => { _loadedPanels[uiPanelType].gameObject.SetActive(false); });
_loadedSinglePanels[uiPanelType].Close(() =>
{
_loadedSinglePanels[uiPanelType].gameObject.SetActive(false);
});
}
public void TryLoadPanel(UIPanelType uiPanelType) => _factory.LoadPanel(uiPanelType);
public void TryLoadCreatePanel(UIPanelType uiPanelType, Transform parent = null) => _factory.LoadPanel(uiPanelType, parent);
public void UIPanelLoaded(UIPanel panel, UIPanelType panelType)
{
_loadedPanels.Add(panelType, panel);
panel.PanelType = panelType;
if (!_factory.CheckIsMultiple(panelType))
_loadedSinglePanels.Add(panelType, panel);
else
{
if (!_loadedMultiplePanels.ContainsKey(panelType))
_loadedMultiplePanels.Add(panelType, new List<UIPanel>());
_loadedMultiplePanels[panelType].Add(panel);
}
if (panel.InjectMeSenpai)
GameObjectInjector.InjectRecursive(panel.gameObject, Container.RootContainer);
else
GameObjectInjector.InjectSingle(panel.gameObject, Container.RootContainer);
// GameObjectInjector.InjectRecursive(panel.gameObject, SceneManager.GetActiveScene().GetSceneContainer()); // Скорее всего будут нужны компоненты текущей сцены
_eventBus.RaiseEvent<IUIPanelLoaded>(ui => ui.UILoaded(panelType));
panel.FireCreatedEvent();
}
public void TryRemovePanel(UIPanelType uiPanelType)
{
_loadedPanels[uiPanelType].Close(() =>
if (_factory.CheckIsMultiple(uiPanelType))
{
_loadedPanels[uiPanelType].gameObject.SetActive(false);
UnityEngine.Debug.LogError("Это для единичных панелей олух");
return;
}
_loadedSinglePanels[uiPanelType].Close(() =>
{
_loadedSinglePanels[uiPanelType].gameObject.SetActive(false);
RemovePanel(uiPanelType);
});
}
public void TryRemovePanel(UIPanel panel)
{
panel.Close(() =>
{
panel.gameObject.SetActive(false);
RemovePanel(panel);
// _eventBus.RaiseEvent<IUIMultiplePanelHandle>(x=> x.UIMultiplePanelRemoved(panel));
});
}
private void RemovePanel(UIPanelType panelType)
{
_factory.ReleasePanel(_loadedPanels[panelType]);
_loadedPanels.Remove(panelType);
if (!_factory.CheckIsMultiple(panelType))
{
var temp = _loadedSinglePanels[panelType];
_loadedSinglePanels.Remove(panelType);
temp.FireRemovedEvent();
_factory.ReleasePanel(temp);
}
else
{
var temp = _loadedMultiplePanels[panelType];
_loadedMultiplePanels.Remove(panelType);
foreach (var panel in temp)
{
panel.FireRemovedEvent();
_factory.ReleasePanel(panel);
}
}
}
public UIPanel TryGetPanel(UIPanelType panelType) => _loadedPanels.GetValueOrDefault(panelType);
}
private void RemovePanel(UIPanel panel)
{
_loadedMultiplePanels[panel.PanelType].Remove(panel);
panel.FireRemovedEvent();
public interface IUIPanelLoaded : IGlobalSubscriber
{
void UILoaded(UIPanelType uiPanelType);
_factory.ReleasePanel(panel);
if(_loadedMultiplePanels[panel.PanelType].Count == 0) _loadedMultiplePanels.Remove(panel.PanelType);
}
public UIPanel TryGetSinglePanel(UIPanelType panelType) => _loadedSinglePanels.GetValueOrDefault(panelType);
public List<UIPanel> TryGetMultiplePanels(UIPanelType panelType) => _loadedMultiplePanels.GetValueOrDefault(panelType);
}
}
+178 -2
View File
@@ -31,7 +31,7 @@
]
},
{
"name": "Player",
"name": "Race",
"id": "df70fa95-8a34-4494-b137-73ab6b9c7d37",
"actions": [
{
@@ -65,7 +65,7 @@
"name": "Attack",
"type": "Button",
"id": "6c2ab1b8-8984-453a-af3d-a3c78ae1679a",
"expectedControlType": "Button",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
@@ -524,6 +524,182 @@
}
]
},
{
"name": "Platformer",
"id": "40cb7908-4da6-4c87-b920-2b844b3218f6",
"actions": [
{
"name": "Move",
"type": "Value",
"id": "9bf834c4-d1a4-45ed-bb7c-d2bdf3f3e315",
"expectedControlType": "Vector2",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "Brake",
"type": "Button",
"id": "7f2126e6-bbec-4c2a-b618-0dbca52cd042",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Attack",
"type": "Button",
"id": "7d31109a-00f6-4131-aa36-bcdc4859f642",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Sprint",
"type": "Button",
"id": "fcc52df1-fd26-4d3d-ad2b-2f790c76cc0c",
"expectedControlType": "",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
{
"name": "WASD",
"id": "8903ed29-eb88-4f99-8d95-6c8e421ee6f2",
"path": "Dpad",
"interactions": "",
"processors": "",
"groups": "",
"action": "Move",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "up",
"id": "122a382c-8e70-43cc-b8f5-c3894ddad62d",
"path": "<Keyboard>/w",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "up",
"id": "934bf63a-3b77-4f15-bcee-3b56bf991856",
"path": "<Keyboard>/upArrow",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "c827aa40-0f6d-4b4a-8cb7-0faca68c9ad9",
"path": "<Keyboard>/s",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "down",
"id": "74a1aef0-68e8-4459-adbe-9beaaa5dc912",
"path": "<Keyboard>/downArrow",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "79813cf5-83d8-43f0-9334-8a7c06c4084a",
"path": "<Keyboard>/a",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "left",
"id": "12588093-45c6-4429-ab90-898ee680f20c",
"path": "<Keyboard>/leftArrow",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "39f297a2-959f-460b-899a-6b5bcb120351",
"path": "<Keyboard>/d",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "right",
"id": "ecc53228-111e-4d21-9d12-4e44a6058a29",
"path": "<Keyboard>/rightArrow",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Move",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "e483ce90-354f-4db1-ba5e-5152406920ed",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Brake",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "5610643d-b7a2-4115-8b4c-4a783faa6898",
"path": "<Keyboard>/e",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Attack",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "75a0e210-258a-46bb-a038-eacab792befc",
"path": "<Keyboard>/shift",
"interactions": "",
"processors": "",
"groups": ";Keyboard&Mouse",
"action": "Sprint",
"isComposite": false,
"isPartOfComposite": false
}
]
},
{
"name": "UI",
"id": "272f6d14-89ba-496f-b7ff-215263d3219f",
@@ -22,21 +22,21 @@ AnimationClip:
curve:
- time: 0
value: {fileID: 1526024632, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
- time: 0.083333336
- time: 0.05
value: {fileID: -149383372, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
- time: 0.16666667
- time: 0.1
value: {fileID: -1161840778, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
- time: 0.25
- time: 0.15
value: {fileID: 1802860133, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
- time: 0.33333334
- time: 0.2
value: {fileID: 55767095, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
- time: 0.41666666
- time: 0.26666668
value: {fileID: 529439664, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
- time: 0.5
- time: 0.31666666
value: {fileID: 1184257701, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
- time: 0.5833333
- time: 0.36666667
value: {fileID: -1605253944, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
- time: 0.6666667
- time: 0.41666666
value: {fileID: -1605253944, guid: 481e518c0a26ed391b01df46ad010f8f, type: 3}
attribute: m_Sprite
path:
@@ -74,7 +74,7 @@ AnimationClip:
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.68333334
m_StopTime: 0.43333334
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
@@ -93,4 +93,25 @@ AnimationClip:
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []
m_Events:
- time: 0.05
functionName: CastAttack
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.26666668
functionName: CastAttack
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 0.4
functionName: AttackEnd
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
@@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 6786408946074889384}
- component: {fileID: 7285218563850982413}
- component: {fileID: 5637894485084274858}
m_Layer: 0
m_Layer: 10
m_Name: Player
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -123,7 +123,7 @@ Rigidbody2D:
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_Mass: 0.5
m_LinearDamping: 0
m_AngularDamping: 0.05
m_GravityScale: 1
@@ -137,7 +137,7 @@ Rigidbody2D:
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
m_Constraints: 4
--- !u!95 &7285218563850982413
Animator:
serializedVersion: 7
@@ -177,7 +177,7 @@ AnimatorStateTransition:
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Attacking
m_ConditionEvent: OnAttack
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 829475626526463519}
@@ -253,7 +253,7 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: Attacking
- m_Name: OnAttack
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
@@ -63,7 +63,7 @@ BoxCollider2D:
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_IsTrigger: 1
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
@@ -246,7 +246,7 @@ Rigidbody2D:
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 1
m_Mass: 0.861575
m_Mass: 0.105875
m_LinearDamping: 0
m_AngularDamping: 0.05
m_GravityScale: 1
@@ -298,7 +298,6 @@ MonoBehaviour:
rigidbody2D: {fileID: 8711850399479606103}
animator: {fileID: -3155582984912602300}
spriteRenderer: {fileID: 7973072655843182893}
groundPoint: {x: 0, y: 0}
groundLeft: {x: 0, y: 0}
groundRight: {x: 0, y: 0}
_directionRight: 0
groundPoint: {x: 0, y: -0.4}
groundLeft: {x: -0.3, y: -0.4}
groundRight: {x: 0.3, y: -0.4}
@@ -9,12 +9,10 @@ MonoBehaviour:
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9759979f397044a5bcb03ded0d1c9561, type: 3}
m_Name: ScenesAssetReferences
m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.SceneLoader.ScenesAssetReferences
gameplaySceneReference:
m_AssetGUID:
m_SubObjectName:
m_SubObjectType:
m_SubObjectGUID:
m_EditorAssetChanged: 0
m_Script: {fileID: 11500000, guid: 614273355800ddbe584d9d7404b5a234, type: 3}
m_Name: Enemies
m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Configs.LayerMasksConfigConfig
mask:
serializedVersion: 2
m_Bits: 2048
type: 1
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d54fabdcc748a594aa0551dcd235c7c2
guid: cc76fd76d78cd364880ebe8330a05834
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
@@ -9,7 +9,10 @@ MonoBehaviour:
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2bdfef8d142a3e1438c89da242d2be2f, type: 3}
m_Name: DebugClassConfig
m_EditorClassIdentifier: Assembly-CSharp::DebugClassConfig
_a: 5
m_Script: {fileID: 11500000, guid: 614273355800ddbe584d9d7404b5a234, type: 3}
m_Name: Player
m_EditorClassIdentifier: Assembly-CSharp::Code.Infrastructure.Configs.LayerMasksConfigConfig
mask:
serializedVersion: 2
m_Bits: 1024
type: 2
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a78f552da8f156b469b95652e4b0209d
guid: 69e720c0a88f4f9499af76a887cd9fdf
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
@@ -207,6 +207,144 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &321811368
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 321811371}
- component: {fileID: 321811370}
- component: {fileID: 321811369}
m_Layer: 9
m_Name: Buildings_0 (5)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!61 &321811369
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 321811368}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 1
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.8, y: 0.67}
newSize: {x: 0.8, y: 0.67}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 0.8, y: 0.67}
m_EdgeRadius: 0
--- !u!212 &321811370
SpriteRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 321811368}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_Sprite: {fileID: -1902027194, guid: 6b7c943308e1fcdd5b986969ed12d0ae, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.8, y: 0.67}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!4 &321811371
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 321811368}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.584, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 595108274}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &494311809
GameObject:
m_ObjectHideFlags: 0
@@ -218,8 +356,6 @@ GameObject:
- component: {fileID: 494311810}
- component: {fileID: 494311812}
- component: {fileID: 494311811}
- component: {fileID: 494311814}
- component: {fileID: 494311813}
m_Layer: 9
m_Name: Buildings_0 (3)
m_TagString: Untagged
@@ -347,13 +483,52 @@ SpriteRenderer:
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!66 &494311813
--- !u!1 &595108273
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 595108274}
- component: {fileID: 595108276}
- component: {fileID: 595108275}
m_Layer: 9
m_Name: Location
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &595108274
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 595108273}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.707, y: -0.802, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1237014523}
- {fileID: 494311810}
- {fileID: 1947090012}
- {fileID: 2009006007}
- {fileID: 2086297240}
- {fileID: 321811371}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!66 &595108275
CompositeCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 494311809}
m_GameObject: {fileID: 595108273}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
@@ -382,39 +557,89 @@ CompositeCollider2D:
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_GeometryType: 0
m_GeometryType: 1
m_GenerationType: 0
m_EdgeRadius: 0
m_ColliderPaths:
- m_Collider: {fileID: 1237014524}
m_ColliderPaths:
- - X: -12090000
Y: 3350000
- X: -20090000
Y: 3350000
- X: -20090000
Y: -3350000
- X: -12090000
Y: -3350000
- m_Collider: {fileID: 494311811}
m_ColliderPaths:
- - X: 4000000
- - X: -20070000
Y: 3350000
- X: -4000000
- X: -28070002
Y: 3350000
- X: -4000000
- X: -28070002
Y: -3350000
- X: 4000000
- X: -20070000
Y: -3350000
- m_Collider: {fileID: 1947090010}
m_ColliderPaths:
- - X: -4100000
Y: 3350000
- X: -12100000
Y: 3350000
- X: -12100000
Y: -3350000
- X: -4100000
Y: -3350000
- m_Collider: {fileID: 2009006005}
m_ColliderPaths:
- - X: 11850001
Y: 3350000
- X: 3850000
Y: 3350000
- X: 3850000
Y: -3350000
- X: 11850001
Y: -3350000
- m_Collider: {fileID: 2086297238}
m_ColliderPaths:
- - X: 3889999
Y: 3350000
- X: -4110000
Y: 3350000
- X: -4110000
Y: -3350000
- X: 3889999
Y: -3350000
- m_Collider: {fileID: 321811369}
m_ColliderPaths:
- - X: 19839998
Y: 3350000
- X: 11839999
Y: 3350000
- X: 11839999
Y: -3350000
- X: 19839998
Y: -3350000
m_CompositePaths:
m_Paths:
- - {x: 0.3999707, y: -0.335}
- {x: 0.3999707, y: 0.335}
- {x: -0.4, y: 0.3349707}
- {x: -0.3999707, y: -0.335}
- - {x: -2.8070002, y: -0.335}
- {x: 1.9839998, y: -0.335}
- {x: 1.9839998, y: 0.335}
- {x: -2.8070002, y: 0.335}
m_VertexDistance: 0.0005
m_OffsetDistance: 0.00005
m_OffsetDistance: 0
m_UseDelaunayMesh: 0
m_CompositeGameObject: {fileID: 494311809}
--- !u!50 &494311814
m_CompositeGameObject: {fileID: 595108273}
--- !u!50 &595108276
Rigidbody2D:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 494311809}
m_BodyType: 0
m_GameObject: {fileID: 595108273}
m_BodyType: 2
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
@@ -433,41 +658,6 @@ Rigidbody2D:
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!1 &595108273
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 595108274}
m_Layer: 0
m_Name: Location
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &595108274
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 595108273}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.707, y: -0.802, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1237014523}
- {fileID: 494311810}
- {fileID: 1947090012}
- {fileID: 2086297240}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1237014521
GameObject:
m_ObjectHideFlags: 0
@@ -592,7 +782,7 @@ BoxCollider2D:
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOperation: 1
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
@@ -778,7 +968,7 @@ BoxCollider2D:
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOperation: 1
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
@@ -866,6 +1056,144 @@ Transform:
m_Children: []
m_Father: {fileID: 595108274}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2009006004
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2009006007}
- component: {fileID: 2009006006}
- component: {fileID: 2009006005}
m_Layer: 9
m_Name: Buildings_0 (4)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!61 &2009006005
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2009006004}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 1
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 0.8, y: 0.67}
newSize: {x: 0.8, y: 0.67}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 0.8, y: 0.67}
m_EdgeRadius: 0
--- !u!212 &2009006006
SpriteRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2009006004}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_Sprite: {fileID: -1902027194, guid: 6b7c943308e1fcdd5b986969ed12d0ae, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.8, y: 0.67}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!4 &2009006007
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2009006004}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.785, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 595108274}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2086297237
GameObject:
m_ObjectHideFlags: 0
@@ -916,7 +1244,7 @@ BoxCollider2D:
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOperation: 1
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
@@ -1016,18 +1344,6 @@ PrefabInstance:
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
- target: {fileID: 454703662689100337, guid: 234ab51636edcbab88dbadfdb7fbfe65, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 6786408946074889384, guid: 234ab51636edcbab88dbadfdb7fbfe65, type: 3}
propertyPath: m_Mass
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 6786408946074889384, guid: 234ab51636edcbab88dbadfdb7fbfe65, type: 3}
propertyPath: m_Constraints
value: 4
objectReference: {fileID: 0}
- target: {fileID: 8736793596959961972, guid: 234ab51636edcbab88dbadfdb7fbfe65, type: 3}
propertyPath: m_LocalPosition.x
value: 0.07
@@ -1133,10 +1449,6 @@ PrefabInstance:
propertyPath: 'partolPoints.Array.data[1]'
value:
objectReference: {fileID: 1369074043}
- target: {fileID: 8927136534498308671, guid: 0eb645a0c96b1c437bf0712d6b856b7c, type: 3}
propertyPath: m_Simulated
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@@ -1194,26 +1506,6 @@ PrefabInstance:
propertyPath: m_Name
value: Boar
objectReference: {fileID: 0}
- target: {fileID: 5713908768014139622, guid: d0a994964f42e0c0dad3da32f7b52c90, type: 3}
propertyPath: groundLeft.x
value: -0.3
objectReference: {fileID: 0}
- target: {fileID: 5713908768014139622, guid: d0a994964f42e0c0dad3da32f7b52c90, type: 3}
propertyPath: groundLeft.y
value: -0.4
objectReference: {fileID: 0}
- target: {fileID: 5713908768014139622, guid: d0a994964f42e0c0dad3da32f7b52c90, type: 3}
propertyPath: groundPoint.y
value: -0.4
objectReference: {fileID: 0}
- target: {fileID: 5713908768014139622, guid: d0a994964f42e0c0dad3da32f7b52c90, type: 3}
propertyPath: groundRight.x
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 5713908768014139622, guid: d0a994964f42e0c0dad3da32f7b52c90, type: 3}
propertyPath: groundRight.y
value: -0.4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@@ -1231,17 +1523,13 @@ PrefabInstance:
propertyPath: m_Name
value: Snail
objectReference: {fileID: 0}
- target: {fileID: 2523079170963062473, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
propertyPath: m_Layer
value: 11
objectReference: {fileID: 0}
- target: {fileID: 4330041015761084350, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
propertyPath: m_LocalPosition.x
value: -0.346
objectReference: {fileID: 0}
- target: {fileID: 4330041015761084350, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
propertyPath: m_LocalPosition.y
value: -0.292
value: -0.306
objectReference: {fileID: 0}
- target: {fileID: 4330041015761084350, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
propertyPath: m_LocalPosition.z
@@ -1276,60 +1564,14 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6897803134956731688, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
propertyPath: m_Mass
value: 0.1
objectReference: {fileID: 0}
- target: {fileID: 6897803134956731688, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
propertyPath: m_Simulated
propertyPath: m_CollisionDetection
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 2523079170963062473, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
insertIndex: -1
addedObject: {fileID: 7850265554012673611}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
--- !u!1 &7850265554012673607 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2523079170963062473, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
m_PrefabInstance: {fileID: 7850265554012673606}
m_PrefabAsset: {fileID: 0}
--- !u!95 &7850265554012673608 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 958628273609526838, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
m_PrefabInstance: {fileID: 7850265554012673606}
m_PrefabAsset: {fileID: 0}
--- !u!50 &7850265554012673609 stripped
Rigidbody2D:
m_CorrespondingSourceObject: {fileID: 6897803134956731688, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
m_PrefabInstance: {fileID: 7850265554012673606}
m_PrefabAsset: {fileID: 0}
--- !u!212 &7850265554012673610 stripped
SpriteRenderer:
m_CorrespondingSourceObject: {fileID: 200530768292093389, guid: 77a268730c52ad461920f3459fdda1a0, type: 3}
m_PrefabInstance: {fileID: 7850265554012673606}
m_PrefabAsset: {fileID: 0}
--- !u!114 &7850265554012673611
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7850265554012673607}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4bb753139de944f69f426cbc1ec9ec92, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Code.Example.Platformer.Entity.Enemies.Snail
rigidbody2D: {fileID: 7850265554012673609}
animator: {fileID: 7850265554012673608}
spriteRenderer: {fileID: 7850265554012673610}
groundPoint: {x: 0, y: -0.2}
groundLeft: {x: -0.3, y: -0.2}
groundRight: {x: 0.3, y: -0.2}
_directionRight: 1
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@@ -13,7 +13,8 @@ GameObject:
- component: {fileID: 6713950355016476722}
- component: {fileID: 6897803134956731688}
- component: {fileID: 958628273609526838}
m_Layer: 0
- component: {fileID: 3604994681784900202}
m_Layer: 11
m_Name: Snail
m_TagString: Untagged
m_Icon: {fileID: 0}
@@ -152,7 +153,7 @@ Rigidbody2D:
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 0.064399995
m_Mass: 0.1
m_LinearDamping: 0
m_AngularDamping: 0.05
m_GravityScale: 1
@@ -189,3 +190,22 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0
--- !u!114 &3604994681784900202
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2523079170963062473}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4bb753139de944f69f426cbc1ec9ec92, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Code.Example.Platformer.Entity.Enemies.Snail
rigidbody2D: {fileID: 6897803134956731688}
animator: {fileID: 958628273609526838}
spriteRenderer: {fileID: 200530768292093389}
groundPoint: {x: 0, y: -0.2}
groundLeft: {x: -0.3, y: -0.2}
groundRight: {x: 0.3, y: -0.2}
_directionRight: 1
@@ -0,0 +1,38 @@
// retard-generated
using Code.Infrastructure.EventBus;
using Code.Infrastructure.StateMachine;
using Code.Infrastructure.UI;
namespace Code.Example.Race.UI
{
public partial class PlayerScoreCounter
{
public override void FireCreatedEvent()
{
_eventBus.RaiseEvent<IPlayerScoreCounterCreatedHandle>(h => h.PlayerScoreCounterCreated(this));
}
public override void FireRemovedEvent()
{
_eventBus.RaiseEvent<IPlayerScoreCounterRemovedHandle>(h => h.PlayerScoreCounterRemoved());
}
}
public interface IPlayerScoreCounterCreatedHandle : IGlobalSubscriber
{
void PlayerScoreCounterCreated(UIPanel panel);
}
public interface IPlayerScoreCounterRemovedHandle : IGlobalSubscriber
{
void PlayerScoreCounterRemoved();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3e7bcd1ea1d0c9d409ebc2fbfb7bcbda
@@ -0,0 +1,38 @@
// retard-generated
using Code.Infrastructure.EventBus;
using Code.Infrastructure.StateMachine;
using Code.Infrastructure.UI;
namespace Code.Example.Race.UI
{
public partial class PlayerScores
{
public override void FireCreatedEvent()
{
_eventBus.RaiseEvent<IPlayerScoresCreatedHandle>(h => h.PlayerScoresCreated(this));
}
public override void FireRemovedEvent()
{
_eventBus.RaiseEvent<IPlayerScoresRemovedHandle>(h => h.PlayerScoresRemoved());
}
}
public interface IPlayerScoresCreatedHandle : IGlobalSubscriber
{
void PlayerScoresCreated(UIPanel panel);
}
public interface IPlayerScoresRemovedHandle : IGlobalSubscriber
{
void PlayerScoresRemoved();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ed4ee430bfb443e45888c6b7c8d9737a
@@ -0,0 +1,38 @@
// retard-generated
using Code.Infrastructure.UI;
using Code.Infrastructure.EventBus;
using Code.Infrastructure.StateMachine;
namespace Code.Example.Race.UI
{
public partial class WinScreen
{
public override void FireCreatedEvent()
{
_eventBus.RaiseEvent<IWinScreenCreatedHandle>(h => h.WinScreenCreated(this));
}
public override void FireRemovedEvent()
{
_eventBus.RaiseEvent<IWinScreenRemovedHandle>(h => h.WinScreenRemoved());
}
}
public interface IWinScreenCreatedHandle : IGlobalSubscriber
{
void WinScreenCreated(UIPanel panel);
}
public interface IWinScreenRemovedHandle : IGlobalSubscriber
{
void WinScreenRemoved();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 316bf9eb00546714d8ae3e96b0f563f7
@@ -5,12 +5,12 @@ using Code.Infrastructure.StateMachine;
using Code.Infrastructure.App.States;
using Code.Infrastructure.App.States;
using Code.Example.Platformer;
using Code.Infrastructure.App.States;
using Code.Infrastructure.App.States;
#pragma warning restore CS0105
namespace Code.Infrastructure.App
{
@@ -21,18 +21,18 @@ public partial class AppStateMachine : AbstractStateMachine<Code.Infrastructure.
public AppStateMachine(Code.Infrastructure.App.AppStateMachineContext context, EventBus.EventBus eventBus) : base(context)
{
var stateMainMenuState = new MainMenuState(StateMachineContext,eventBus);
States.Add(stateMainMenuState.myState, stateMainMenuState);
var statePlatformerState = new PlatformerState(StateMachineContext,eventBus);
States.Add(statePlatformerState.myState, statePlatformerState);
var stateGameplayState = new GameplayState(StateMachineContext,eventBus);
States.Add(stateGameplayState.myState, stateGameplayState);
var stateBootstrapState = new BootstrapState(StateMachineContext,eventBus);
States.Add(stateBootstrapState.myState, stateBootstrapState);
var statePlatformerState = new PlatformerState(StateMachineContext,eventBus);
States.Add(statePlatformerState.myState, statePlatformerState);
var stateMainMenuState = new MainMenuState(StateMachineContext,eventBus);
States.Add(stateMainMenuState.myState, stateMainMenuState);
}
protected override bool CheckTransitionAllowed(Code.Infrastructure.App.AppStates nextState) => AllowedStates.HasFlag(nextState);
@@ -17,12 +17,12 @@ public partial class CameraStateMachine : AbstractStateMachine<Code.Infrastructu
public CameraStateMachine(Code.Infrastructure.Camera.CameraStateMachineContext context, EventBus.EventBus eventBus) : base(context)
{
var stateNoneCameraState = new NoneCameraState(StateMachineContext,eventBus);
States.Add(stateNoneCameraState.myState, stateNoneCameraState);
var stateThirdPersonState = new ThirdPersonState(StateMachineContext,eventBus);
States.Add(stateThirdPersonState.myState, stateThirdPersonState);
var stateNoneCameraState = new NoneCameraState(StateMachineContext,eventBus);
States.Add(stateNoneCameraState.myState, stateNoneCameraState);
}
protected override bool CheckTransitionAllowed(Code.Infrastructure.Camera.CameraMode nextState) => AllowedStates.HasFlag(nextState);
@@ -0,0 +1,37 @@
// retard-generated
using Code.Infrastructure.EventBus;
using Code.Infrastructure.StateMachine;
namespace Code.Infrastructure.UI.Panels
{
public partial class LoadingPanel
{
public override void FireCreatedEvent()
{
_eventBus.RaiseEvent<ILoadingPanelCreatedHandle>(h => h.LoadingPanelCreated(this));
}
public override void FireRemovedEvent()
{
_eventBus.RaiseEvent<ILoadingPanelRemovedHandle>(h => h.LoadingPanelRemoved());
}
}
public interface ILoadingPanelCreatedHandle : IGlobalSubscriber
{
void LoadingPanelCreated(UIPanel panel);
}
public interface ILoadingPanelRemovedHandle : IGlobalSubscriber
{
void LoadingPanelRemoved();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 366a0dfcffa8af64a9692870e278d0ff
@@ -0,0 +1,37 @@
// retard-generated
using Code.Infrastructure.EventBus;
using Code.Infrastructure.StateMachine;
namespace Code.Infrastructure.UI.Panels
{
public partial class LogoPanel
{
public override void FireCreatedEvent()
{
_eventBus.RaiseEvent<ILogoPanelCreatedHandle>(h => h.LogoPanelCreated(this));
}
public override void FireRemovedEvent()
{
_eventBus.RaiseEvent<ILogoPanelRemovedHandle>(h => h.LogoPanelRemoved());
}
}
public interface ILogoPanelCreatedHandle : IGlobalSubscriber
{
void LogoPanelCreated(UIPanel panel);
}
public interface ILogoPanelRemovedHandle : IGlobalSubscriber
{
void LogoPanelRemoved();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c5614b342dee1c34cb8a1f79905cdb24
@@ -0,0 +1,37 @@
// retard-generated
using Code.Infrastructure.EventBus;
using Code.Infrastructure.StateMachine;
namespace Code.Infrastructure.UI.Panels
{
public partial class MenuChoosePanel
{
public override void FireCreatedEvent()
{
_eventBus.RaiseEvent<IMenuChoosePanelCreatedHandle>(h => h.MenuChoosePanelCreated(this));
}
public override void FireRemovedEvent()
{
_eventBus.RaiseEvent<IMenuChoosePanelRemovedHandle>(h => h.MenuChoosePanelRemoved());
}
}
public interface IMenuChoosePanelCreatedHandle : IGlobalSubscriber
{
void MenuChoosePanelCreated(UIPanel panel);
}
public interface IMenuChoosePanelRemovedHandle : IGlobalSubscriber
{
void MenuChoosePanelRemoved();
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a8d4139d7ff2ab94e94b856369f4e30a
@@ -1,18 +1,18 @@
#pragma warning disable CS0105
using Code.Example.Race.Racer;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Configs;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Camera;
using Code.Infrastructure.UI;
using Code.Infrastructure.UI;
using Code.Infrastructure.Audio;
using Code.Infrastructure.SceneLoader;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Volume;
using Code.Example.Platformer.Entity;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Input;
using Code.Infrastructure.UI;
using Code.Example.Platformer.Entity;
using Code.Infrastructure.Configs;
using Code.Example.Race.Racer;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Audio;
using Code.Infrastructure.UI;
using Code.Infrastructure.Camera;
using UnityEngine;
#pragma warning restore CS0105
@@ -26,32 +26,32 @@ using Code.Infrastructure.Input;
{
SystemConfigsReferences systemConfigsReferences = Resources.Load<SystemConfigsReferences>("SystemConfigsReferences");
_multipleConfigReferences.Add(typeof(Code.Example.Race.Racer.RacerSettingsConfig), systemConfigsReferences.RacerSettings);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Camera.CameraSettingsConfig), systemConfigsReferences.CameraSettings);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Configs.LayerMasksConfigConfig), systemConfigsReferences.LayerMasksConfig);
_singleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourcePrefabConfig), systemConfigsReferences.AudioSourcePrefab);
_singleConfigReferences.Add(typeof(Code.Infrastructure.Camera.GameCameraConfig), systemConfigsReferences.GameCamera);
_singleConfigReferences.Add(typeof(Code.Infrastructure.UI.CanvasSettingsConfig), systemConfigsReferences.CanvasSettings);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.UI.UIPanelSettingsConfig), systemConfigsReferences.UIPanelSettings);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourceSettingsConfig), systemConfigsReferences.AudioSourceSettings);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.SceneLoader.SceneInfoConfig), systemConfigsReferences.SceneInfo);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioInfoConfig), systemConfigsReferences.AudioInfo);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Volume.VolumeSettingsConfig), systemConfigsReferences.VolumeSettings);
_multipleConfigReferences.Add(typeof(Code.Example.Platformer.Entity.PlatformerEnemySettingsConfig), systemConfigsReferences.PlatformerEnemySettings);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourceSettingsConfig), systemConfigsReferences.AudioSourceSettings);
_singleConfigReferences.Add(typeof(Code.Infrastructure.Input.InputServiceConfig), systemConfigsReferences.InputService);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.UI.UIPanelSettingsConfig), systemConfigsReferences.UIPanelSettings);
_multipleConfigReferences.Add(typeof(Code.Example.Platformer.Entity.PlatformerEntitySettingsConfig), systemConfigsReferences.PlatformerEnemySettings);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Configs.LayerMasksConfigConfig), systemConfigsReferences.LayerMasksConfig);
_multipleConfigReferences.Add(typeof(Code.Example.Race.Racer.RacerSettingsConfig), systemConfigsReferences.RacerSettings);
_singleConfigReferences.Add(typeof(Code.Infrastructure.Camera.GameCameraConfig), systemConfigsReferences.GameCamera);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioInfoConfig), systemConfigsReferences.AudioInfo);
_singleConfigReferences.Add(typeof(Code.Infrastructure.Audio.AudioSourcePrefabConfig), systemConfigsReferences.AudioSourcePrefab);
_singleConfigReferences.Add(typeof(Code.Infrastructure.UI.CanvasSettingsConfig), systemConfigsReferences.CanvasSettings);
_multipleConfigReferences.Add(typeof(Code.Infrastructure.Camera.CameraSettingsConfig), systemConfigsReferences.CameraSettings);
//_singleConfigReferences.Add(typeof(ScenesAssetReferences), systemConfigsReferences.scenesAssetReferences);
}
}
@@ -9,9 +9,9 @@ using UnityEngine.AddressableAssets;
namespace Code.Example.Platformer.Entity{
#pragma warning restore CS0105
[CreateAssetMenu(fileName = "PlatformerEnemySettingsConfig", menuName = "Configs/Gameplay/Platformer/EnemySettings")]
public class PlatformerEnemySettingsConfig : ScriptableObject
public class PlatformerEntitySettingsConfig : ScriptableObject
{
public Code.Example.Platformer.Entity.PlatformerEnemyData racerData;
public Code.Example.Platformer.Entity.PlatformerEntityData racerData;
public UnityEngine.AddressableAssets.AssetReference prefabReference;
}
@@ -1,18 +1,18 @@
#pragma warning disable CS0105
using Code.Example.Race.Racer;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Configs;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Camera;
using Code.Infrastructure.UI;
using Code.Infrastructure.UI;
using Code.Infrastructure.Audio;
using Code.Infrastructure.SceneLoader;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Volume;
using Code.Example.Platformer.Entity;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Input;
using Code.Infrastructure.UI;
using Code.Example.Platformer.Entity;
using Code.Infrastructure.Configs;
using Code.Example.Race.Racer;
using Code.Infrastructure.Camera;
using Code.Infrastructure.Audio;
using Code.Infrastructure.Audio;
using Code.Infrastructure.UI;
using Code.Infrastructure.Camera;
using UnityEngine.AddressableAssets;
#pragma warning restore CS0105
@@ -20,19 +20,19 @@ using Code.Infrastructure.Input;
namespace Code.Infrastructure.Configs{
public partial class SystemConfigsReferences
{
public string RacerSettings;
public string CameraSettings;
public string LayerMasksConfig;
public AssetReference AudioSourcePrefab;
public AssetReference GameCamera;
public AssetReference CanvasSettings;
public string UIPanelSettings;
public string AudioSourceSettings;
public string SceneInfo;
public string AudioInfo;
public string VolumeSettings;
public string PlatformerEnemySettings;
public string AudioSourceSettings;
public AssetReference InputService;
public string UIPanelSettings;
public string PlatformerEnemySettings;
public string LayerMasksConfig;
public string RacerSettings;
public AssetReference GameCamera;
public string AudioInfo;
public AssetReference AudioSourcePrefab;
public AssetReference CanvasSettings;
public string CameraSettings;
}
}
@@ -2,6 +2,7 @@
#pragma warning disable CS0105
using UnityEngine.AddressableAssets;
using Code.Infrastructure.UI;
using System;
using UnityEngine;
using UnityEngine.AddressableAssets;
@@ -13,6 +14,7 @@ public class UIPanelSettingsConfig : ScriptableObject
{
public UnityEngine.AddressableAssets.AssetReference Prefab;
public Code.Infrastructure.UI.UIPanelType UIPanelType;
public System.Boolean Multiple;
}
}