mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-03-02 14:29:23 +00:00
55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using Assets._Project.Develop.Runtime.Infrastructure;
|
|
using Assets._Project.Develop.Runtime.Infrastructure.DI;
|
|
using Assets._Project.Develop.Runtime.Utilities.SceneManagement;
|
|
using System;
|
|
using System.Collections;
|
|
using _Project.Develop.Runtime.Entities;
|
|
using _Project.Develop.Runtime.Logic.Gameplay.Features;
|
|
using _Project.Develop.Runtime.Logic.Gameplay.Features.AI;
|
|
using _Project.Develop.Runtime.Utils.InputManagement;
|
|
using UnityEngine;
|
|
|
|
namespace Assets._Project.Develop.Runtime.Gameplay.Infrastructure
|
|
{
|
|
public class GameplayBootstrap : SceneBootstrap
|
|
{
|
|
[SerializeField] private TestGameplay _testGameplay;
|
|
|
|
private DIContainer _container;
|
|
private EntitiesLifeContext _entitiesLifeContext;
|
|
private AIBrainsContext _aiBrainsContext;
|
|
|
|
private IPlayerInput _playerInput;
|
|
|
|
public override void ProcessRegistrations(DIContainer container, IInputSceneArgs sceneArgs = null)
|
|
{
|
|
_container = container;
|
|
|
|
if (sceneArgs is not GameplayInputArgs gameplayInputArgs)
|
|
throw new ArgumentException($"{nameof(sceneArgs)} is not match with {typeof(GameplayInputArgs)} type");
|
|
|
|
GameplayContextRegistrations.Process(_container);
|
|
}
|
|
|
|
public override IEnumerator Initialize()
|
|
{
|
|
_entitiesLifeContext = _container.Resolve<EntitiesLifeContext>();
|
|
_aiBrainsContext = _container.Resolve<AIBrainsContext>();
|
|
|
|
_testGameplay.Initialize(_container);
|
|
yield break;
|
|
}
|
|
|
|
public override void Run()
|
|
{
|
|
_testGameplay.Run();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
_aiBrainsContext?.Update(Time.deltaTime);
|
|
_entitiesLifeContext?.Update(Time.deltaTime);
|
|
}
|
|
}
|
|
}
|