You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
937 B
36 lines
937 B
using System.Collections.Generic;
|
|
using CoreGame.Render.Service;
|
|
using Entitas;
|
|
using UnityEngine;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
public class AssetAddSystem : ReactiveSystem<CombatEntity>
|
|
{
|
|
public AssetAddSystem(Contexts contexts) : base(contexts.combat)
|
|
{
|
|
}
|
|
|
|
protected override ICollector<CombatEntity> GetTrigger(IContext<CombatEntity> context)
|
|
{
|
|
return context.CreateCollector(CombatMatcher.Asset);
|
|
}
|
|
|
|
protected override bool Filter(CombatEntity entity)
|
|
{
|
|
return entity.hasAsset;
|
|
}
|
|
|
|
protected override void Execute(List<CombatEntity> entities)
|
|
{
|
|
foreach (var e in entities)
|
|
{
|
|
e.LoadAsset();
|
|
if (e.hasEquips)
|
|
{
|
|
e.ReplaceComponent(CombatComponentsLookup.Equips, e.equips);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|