Skip to content

Moving the system to Friflo #54

Answered by friflo
cNoNim asked this question in Q&A
Jun 27, 2024 · 2 comments · 14 replies
Discussion options

You must be logged in to vote

Understand.
Your initial example used a simple foreach.
So you can use query.Entites.

So something like.

  protected override void OnUpdate()
  {
      foreach (var entity in Query.Entities)
      {
          ref var attack = ref entity.GetComponent<Attack>();
          if (attack.Ticks-- > 0)
              continue;

          Entity target       = attack.Target;
          var    attackDamage = attack.Damage;

          entity.DeleteEntity();

          if (!_filter.HasEntity(target)) // not sure what this is. May remove?
              continue;

          ref var health  = ref target.GetComponent<Health>();
          var damage      = target.GetComponent<Damage>();
          var totalDa…

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
10 replies
@friflo
Comment options

@cNoNim
Comment options

@cNoNim
Comment options

@friflo
Comment options

Answer selected by friflo
@cNoNim
Comment options

@cNoNim
Comment options

@friflo
Comment options

@cNoNim
Comment options

Comment options

You must be logged in to vote
4 replies
@cNoNim
Comment options

@friflo
Comment options

@friflo
Comment options

@cNoNim
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants