public static void Affect(Entity entity, InteractTemplate template) { var targetsNeeded = template.Effects.Any(e => e.Direction == InteractTemplate.Effect.Directions.Target); if (!targetsNeeded) { Affect(entity, new Entity[0], template); } else { PositionSystem.Global.Interact(entity, targets => Affect(entity, targets.ToArray(), template)); } }
public static void Affect(Entity entity, Entity[] targets, InteractTemplate template) { foreach (var effect in template.Effects) { switch (effect.Direction) { case InteractTemplate.Effect.Directions.Owner: AffectToOwner(entity, effect); break; case InteractTemplate.Effect.Directions.Target: AffectToTarget(entity, targets, effect); break; } } }