Danro-Jump/Assets/Scripts/Runtime/Gameplay/GameplayInstaller.cs
Danil Iarosh cefb2fd345 Build initial vertical platformer foundation
Подробные изменения:
- Добавлены сцены Bootstrap, MainMenu и Game с текущей вертикальной 9:16 структурой проекта.
- Добавлены runtime-скрипты gameplay-архитектуры: DI через Extenject, спавнер платформ, прогрессия этапов, one-way платформы, игрок, камера и оборудование JumpPad.
- Добавлены ScriptableObject-этапы сложности, weighted-настройки платформ, оборудования, противников и collectibles.
- Добавлены UI Toolkit ресурсы главного меню, preview-материалы, шрифты, спрайты, анимации и игровые prefab-ассеты.
- Перенесена и оформлена новая COM-система для работы с аппаратными портами и StreamingAssets.
- Обновлены проектные гайды, AGENTS.md, правила Git/Git LFS, .gitignore, Unity Packages и ProjectSettings.
- Удалён локальный skill start-required-mcp-servers из репозитория.
2026-05-11 07:41:14 +03:00

60 lines
2.0 KiB
C#

using UnityEngine;
using Zenject;
namespace DanroJump.Gameplay
{
public sealed class GameplayInstaller : MonoInstaller
{
[SerializeField] private JumpPlayerController player;
[SerializeField] private Camera gameplayCamera;
[SerializeField] private PlatformSpawner platformSpawner;
[SerializeField] private GameplayDifficultyProgression difficultyProgression;
public override void InstallBindings()
{
if (!ValidateReferences())
{
return;
}
Container.BindInstance(player).AsSingle();
Container.BindInstance(gameplayCamera).AsSingle();
Container.BindInstance(platformSpawner).AsSingle();
Container.BindInstance(difficultyProgression).AsSingle();
Container.Bind<PlatformContentSpawner>().AsSingle();
Container.QueueForInject(player);
Container.QueueForInject(difficultyProgression);
Container.QueueForInject(platformSpawner);
if (gameplayCamera != null && gameplayCamera.TryGetComponent(out VerticalCameraFollow cameraFollow))
{
Container.QueueForInject(cameraFollow);
}
}
private bool ValidateReferences()
{
var isValid = true;
isValid &= ValidateReference(player, nameof(player));
isValid &= ValidateReference(gameplayCamera, nameof(gameplayCamera));
isValid &= ValidateReference(platformSpawner, nameof(platformSpawner));
isValid &= ValidateReference(difficultyProgression, nameof(difficultyProgression));
return isValid;
}
private bool ValidateReference(Object reference, string fieldName)
{
if (reference != null)
{
return true;
}
Debug.LogError($"{nameof(GameplayInstaller)} is missing '{fieldName}' reference.", this);
return false;
}
}
}