Exemplo n.º 1
0
        private static StampTile[] BuildStamp(int attackRadius2)
        {
            List <Vector2i> primaryStamp = Vector2i.GenerateCircle(attackRadius2);

            List <StampTile> lStamp = new List <StampTile>();

            List <Vector2i> stampDecomp = primaryStamp
                                          .SelectMany(s =>
            {
                return(Vector2i.AllDirections.Select(d => d + s));
            }).ToList();

            foreach (Vector2i position in stampDecomp)
            {
                int i = lStamp.FindIndex(s => s.offset.Equals(position));

                if (i >= 0)
                {
                    StampTile tile = lStamp[i];
                    tile.probability += 0.2f;
                    lStamp[i]         = tile;
                }
                else
                {
                    StampTile tile;
                    tile.offset      = position;
                    tile.probability = 0.2f;
                    lStamp.Add(tile);
                }
            }
            return(lStamp.ToArray());
        }
Exemplo n.º 2
0
        public void SetCriticalZone(Vector2i center, int radius2)
        {
            List <Vector2i> circle = Vector2i.GenerateCircle(radius2)
                                     .Select(v => Vector2i.Wrap(v + center, width, height))
                                     .ToList();

            foreach (Vector2i c in circle)
            {
                map[c.x, c.y].isCritical = true;
            }
        }