using System.Collections.Generic; using CoreGame.Render.Service; using Entitas; using UnityEngine; namespace CoreGame.Render { public class AssetAddSystem : ReactiveSystem { public AssetAddSystem(Contexts contexts) : base(contexts.combat) { } protected override ICollector GetTrigger(IContext context) { return context.CreateCollector(CombatMatcher.Asset); } protected override bool Filter(CombatEntity entity) { return entity.hasAsset; } protected override void Execute(List entities) { foreach (var e in entities) { e.LoadAsset(); if (e.hasEquips) { e.ReplaceComponent(CombatComponentsLookup.Equips, e.equips); } } } } }