Ejemplo n.º 1
0
        public Grid(int width, int height, Vector3 offset, float nodeSize, Vector2Int target, Vector2Int start)
        {
            m_Width  = width;
            m_Height = height;

            m_Nodes = new Node[m_Width, m_Height];

            for (int i = 0; i < m_Nodes.GetLength(0); i++)
            {
                for (int j = 0; j < m_Nodes.GetLength(1); j++)
                {
                    m_Nodes[i, j] = new Node(offset + new Vector3(i + .5f, 0, j + .5f) * nodeSize);
                }
            }

            m_PathFinding = new FlowFieldPathfinding(this, target, start);

            m_PathFinding.UpdateField();
        }
Ejemplo n.º 2
0
        public Grid(int width, int height, Vector3 offset, float nodeSize, Vector2Int start, Vector2Int target)
        {
            m_Height = height;
            m_Width  = width;

            m_TargetCoordinate = target;
            m_StartCoordinate  = start;

            m_Nodes = new Node[m_Width, m_Height];

            for (int i = 0; i < m_Width; i++)
            {
                for (int j = 0; j < m_Height; j++)
                {
                    m_Nodes[i, j] = new Node(offset + new Vector3(i + .5f, 0, j + .5f) * nodeSize);
                }
            }

            // todo replace zero
            m_Pathfinding = new FlowFieldPathfinding(this, target, start);

            m_Pathfinding.UpdateField();
        }
Ejemplo n.º 3
0
 public void UpdatePathfinding()
 {
     m_Pathfinding.UpdateField();
 }