Beispiel #1
0
            public void Tick(ActorMap actorMap)
            {
                if (!Dirty)
                {
                    return;
                }

                var oldActors = currentActors;

                currentActors = Footprint.SelectMany(actorMap.GetActorsAt).ToList();

                var entered = currentActors.Except(oldActors);
                var exited  = oldActors.Except(currentActors);

                if (onActorEntered != null)
                {
                    foreach (var a in entered)
                    {
                        onActorEntered(a);
                    }
                }

                if (onActorExited != null)
                {
                    foreach (var a in exited)
                    {
                        onActorExited(a);
                    }
                }

                Dirty = false;
            }
Beispiel #2
0
            public void Tick(ActorMap am)
            {
                if (!Dirty)
                {
                    return;
                }

                var oldActors = currentActors;
                var delta     = new WVec(range, range, WDist.Zero);

                currentActors = am.ActorsInBox(position - delta, position + delta)
                                .Where(a => (a.CenterPosition - position).HorizontalLengthSquared < range.LengthSquared)
                                .ToList();

                var entered = currentActors.Except(oldActors);
                var exited  = oldActors.Except(currentActors);

                if (onActorEntered != null)
                {
                    foreach (var a in entered)
                    {
                        onActorEntered(a);
                    }
                }

                if (onActorExited != null)
                {
                    foreach (var a in exited)
                    {
                        onActorExited(a);
                    }
                }

                Dirty = false;
            }
Beispiel #3
0
            public void Tick(ActorMap am)
            {
                if (!Dirty)
                {
                    return;
                }

                var oldActors = currentActors;
                var delta     = new WVec(Range, Range, WRange.Zero);

                currentActors = am.ActorsInBox(Position - delta, Position + delta)
                                .Where(a => (a.CenterPosition - Position).HorizontalLengthSquared < Range.Range * Range.Range)
                                .ToList();

                var entered = currentActors.Except(oldActors);
                var exited  = oldActors.Except(currentActors);

                foreach (var a in entered)
                {
                    onActorEntered(a);
                }

                foreach (var a in exited)
                {
                    onActorExited(a);
                }

                Dirty = false;
            }
Beispiel #4
0
            public void Tick(ActorMap am)
            {
                if (!Dirty)
                    return;

                var oldActors = currentActors;
                var delta = new WVec(Range, Range, WRange.Zero);
                currentActors = am.ActorsInBox(Position - delta, Position + delta)
                    .Where(a => (a.CenterPosition - Position).HorizontalLengthSquared < Range.Range * Range.Range)
                    .ToList();

                var entered = currentActors.Except(oldActors);
                var exited = oldActors.Except(currentActors);

                foreach (var a in entered)
                    onActorEntered(a);

                foreach (var a in exited)
                    onActorExited(a);

                Dirty = false;
            }
Beispiel #5
0
            public void Tick(ActorMap am)
            {
                if (!Dirty)
                    return;

                var oldActors = currentActors;
                currentActors = Footprint.SelectMany(c => am.GetUnitsAt(c)).ToList();

                var entered = currentActors.Except(oldActors);
                var exited = oldActors.Except(currentActors);

                if (onActorEntered != null)
                    foreach (var a in entered)
                        onActorEntered(a);

                if (onActorExited != null)
                    foreach (var a in exited)
                        onActorExited(a);

                Dirty = false;
            }
Beispiel #6
0
            public void Tick(ActorMap am)
            {
                if (!Dirty)
                    return;

                var oldActors = currentActors;
                var delta = new WVec(range, range, WDist.Zero);
                currentActors = am.ActorsInBox(position - delta, position + delta)
                    .Where(a => (a.CenterPosition - position).HorizontalLengthSquared < range.LengthSquared)
                    .ToList();

                var entered = currentActors.Except(oldActors);
                var exited = oldActors.Except(currentActors);

                if (onActorEntered != null)
                    foreach (var a in entered)
                        onActorEntered(a);

                if (onActorExited != null)
                    foreach (var a in exited)
                        onActorExited(a);

                Dirty = false;
            }