Exemplo n.º 1
0
        public void Tick(Actor self)
        {
            // TODO: don't tick all the time.
            if (self.Owner == null)
            {
                return;
            }

            var shrouds = self.World.ActorsWithTrait <Shroud>().Select(s => s.Actor.Owner.Shroud);

            if (previousLocation != self.Location && v != null)
            {
                previousLocation = self.Location;

                foreach (var shroud in shrouds)
                {
                    shroud.UnhideActor(self, v, Info.Range);
                }
            }

            if (!self.TraitsImplementing <IDisable>().Any(d => d.Disabled))
            {
                foreach (var shroud in shrouds)
                {
                    shroud.HideActor(self, Info.Range);
                }
            }
            else
            {
                foreach (var shroud in shrouds)
                {
                    shroud.UnhideActor(self, v, Info.Range);
                }
            }

            v = new Shroud.ActorVisibility {
                vis = Shroud.GetVisOrigins(self).ToArray()
            };
        }