示例#1
0
        public IEnumerable <Pair <CPos, Color> > RadarSignatureCells(Actor self)
        {
            var color = Game.Settings.Game.UsePlayerStanceColors ? self.Owner.PlayerStanceColor(self) : self.Owner.Color.RGB;

            if (modifier != null)
            {
                color = modifier.RadarColorOverride(self, color);
            }

            if (info.UseLocation)
            {
                return new[] { Pair.New(self.Location, color) }
            }
            ;

            // PERF: Cache cellToSignature delegate to avoid allocations as color does not change often.
            if (currentColor != color)
            {
                currentColor = color;

                cellToSignature = c => Pair.New(c.First, color);
            }

            return(self.OccupiesSpace.OccupiedCells().Select(cellToSignature));
        }
    }
示例#2
0
        public void PopulateRadarSignatureCells(Actor self, List <Pair <CPos, Color> > destinationBuffer)
        {
            var viewer = self.World.RenderPlayer ?? self.World.LocalPlayer;

            if (IsTraitDisabled || (viewer != null && !Info.ValidStances.HasStance(self.Owner.Stances[viewer])))
            {
                return;
            }

            var color = Game.Settings.Game.UsePlayerStanceColors ? self.Owner.PlayerStanceColor(self) : self.Owner.Color.RGB;

            if (modifier != null)
            {
                color = modifier.RadarColorOverride(self, color);
            }

            if (Info.UseLocation)
            {
                destinationBuffer.Add(Pair.New(self.Location, color));
                return;
            }

            foreach (var cell in self.OccupiesSpace.OccupiedCells())
            {
                destinationBuffer.Add(Pair.New(cell.First, color));
            }
        }
示例#3
0
        public IEnumerable <Pair <CPos, Color> > RadarSignatureCells(Actor self)
        {
            var viewer = self.World.RenderPlayer ?? self.World.LocalPlayer;

            if (IsTraitDisabled || (viewer != null && !Info.ValidStances.HasStance(self.Owner.Stances[viewer])))
            {
                return(NoCells);
            }

            var color = Game.Settings.Game.UsePlayerStanceColors ? self.Owner.PlayerStanceColor(self) : self.Owner.Color.RGB;

            if (modifier != null)
            {
                color = modifier.RadarColorOverride(self, color);
            }

            if (Info.UseLocation)
            {
                return new[] { Pair.New(self.Location, color) }
            }
            ;

            // PERF: Cache cellToSignature delegate to avoid allocations as color does not change often.
            if (currentColor != color)
            {
                currentColor = color;

                cellToSignature = c => Pair.New(c.First, color);
            }

            return(self.OccupiesSpace.OccupiedCells().Select(cellToSignature));
        }
    }
示例#4
0
        public IEnumerable <Pair <CPos, Color> > RadarSignatureCells(Actor self)
        {
            var color = modifier != null?modifier.RadarColorOverride(self) : self.Owner.Color.RGB;

            if (info.UseLocation)
            {
                return new[] { Pair.New(self.Location, color) }
            }
            ;

            return(self.OccupiesSpace.OccupiedCells().Select(c => Pair.New(c.First, color)));
        }
    }