Esempio n. 1
0
        /// <summary>
        /// Remplis la grille de nodes.
        /// </summary>
        /// <param name="gridToPopulate">La grille à remplir</param>
        /// <param name="unwalkableMask">Le layer à concidérer comme intraversable par le seeker</param>
        public Node[,] PopulateGrid(Grid gridToPopulate, int unwalkableMask)
        {
            Vector2 worldBottomLeft = new Vector2();

            unwalkableMask = 1 << unwalkableMask;

            worldBottomLeft.X = gridToPopulate.CurrentPos.X - gridToPopulate.GridWorldSize.X / 2;
            worldBottomLeft.Y = gridToPopulate.CurrentPos.Y - gridToPopulate.GridWorldSize.Y / 2;

            float nodeDiameter = gridToPopulate.NodeRadius * 2;

            Node[,] grid = new Node[gridToPopulate.GridSizeX, gridToPopulate.GridSizeY];

            for (int x = 0; x < gridToPopulate.GridSizeX; x++)
            {
                for (int y = 0; y < gridToPopulate.GridSizeY; y++)
                {
                    Vector2 worldPoint = new Vector2
                    {
                        X = worldBottomLeft.X + (x * nodeDiameter + gridToPopulate.NodeRadius),
                        Y = worldBottomLeft.Y + (y * nodeDiameter + gridToPopulate.NodeRadius)
                    };

                    UnityEngine.Vector2 worldPointUnity = new UnityEngine.Vector2(worldPoint.X, worldPoint.Y);
                    bool walkable = !(Physics2D.OverlapCircle(worldPointUnity, gridToPopulate.NodeRadius, unwalkableMask));
                    grid[x, y] = new Node(walkable, worldPoint, x, y);
                }
            }
            return(grid);
        }
Esempio n. 2
0
        public StatusDrawer()
        {
            textSize = new Vector2(21);
            textColor = Color.Orange;

            var x = HUDInfo.ScreenSizeX();
            var evaderTextSize = Drawing.MeasureText(EvaderText, Font, textSize, FontFlags.None);
            var pathfinderTextSize = Drawing.MeasureText(PathfinderText, Font, textSize, FontFlags.None);

            evaderTextPosition = new Vector2(x - evaderTextSize.X - 10, evaderTextSize.Y + 25);
            pathfinderTextPosition = new Vector2(
                x - pathfinderTextSize.X - 10,
                pathfinderTextSize.Y + evaderTextPosition.Y);
        }
Esempio n. 3
0
 public AbilityDrawer()
 {
     TextColor = Color.White;
     TextSize = new Vector2(20);
     ParticleColor = new Vector3(255, 100, 50);
 }