mirror of
https://github.com/Bragin-Stepan/project-entity.git
synced 2026-04-19 21:19:41 +00:00
feat: att team feature
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
using _Project.Develop.Runtime.Entities;
|
||||
|
||||
namespace _Project.Develop.Runtime.Logic.Gameplay.Features.MainHero
|
||||
{
|
||||
public class IsMainHero : IEntityComponent { }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d7f214ebbb94ba3a40b05d47a56ea32
|
||||
timeCreated: 1773389869
|
||||
@@ -0,0 +1,44 @@
|
||||
using _Project.Develop.Runtime.Configs.Gameplay.Entities;
|
||||
using _Project.Develop.Runtime.Entities;
|
||||
using _Project.Develop.Runtime.Logic.Gameplay.Features.AI;
|
||||
using _Project.Develop.Runtime.Utils.ReactiveManagement;
|
||||
using Assets._Project.Develop.Runtime.Infrastructure.DI;
|
||||
using Assets._Project.Develop.Runtime.Utilities.ConfigsManagement;
|
||||
using UnityEngine;
|
||||
|
||||
namespace _Project.Develop.Runtime.Logic.Gameplay.Features.MainHero
|
||||
{
|
||||
public class MainHeroFactory
|
||||
{
|
||||
private readonly EntitiesFactory _entitiesFactory;
|
||||
private readonly BrainsFactory _brainsFactory;
|
||||
private readonly ConfigsProviderService _configLoader;
|
||||
private readonly EntitiesLifeContext _entitiesLifeContext;
|
||||
|
||||
public MainHeroFactory(DIContainer container)
|
||||
{
|
||||
_entitiesFactory = container.Resolve<EntitiesFactory>();
|
||||
_brainsFactory = container.Resolve<BrainsFactory>();
|
||||
_configLoader = container.Resolve<ConfigsProviderService>();
|
||||
_entitiesLifeContext = container.Resolve<EntitiesLifeContext>();
|
||||
}
|
||||
|
||||
public Entity Create(Vector3 position)
|
||||
{
|
||||
HeroConfigSO config = _configLoader.GetConfig<HeroConfigSO>();
|
||||
|
||||
Entity entity = _entitiesFactory.CreateHero(position, config);
|
||||
|
||||
entity
|
||||
.AddIsMainHero()
|
||||
.AddTeam(new ReactiveVariable<Teams.Teams>(Teams.Teams.MainHero));
|
||||
|
||||
entity.AddCurrentTarget();
|
||||
_brainsFactory.CreateMainHeroBrain(entity);
|
||||
|
||||
_entitiesLifeContext.Add(entity);
|
||||
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f02ea9aeb6334badac37cab0a5e69da0
|
||||
timeCreated: 1773390441
|
||||
Reference in New Issue
Block a user