Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. public void GetReachableTiles()
  2.     {
  3.         for(int i = 0; i < gridArray.GetLength(0); i++)
  4.         {
  5.             for (int j = 0; j < gridArray.GetLength(1); j++)
  6.             {
  7.  
  8.                 Vector2 gridPos = new Vector2(gridArray[i, j].GetComponent<GridStats>().x, gridArray[i, j].GetComponent<GridStats>().y);
  9.                 if(Vector2.Distance(gridPos, new Vector2(startX, startY)) <= playerRange)
  10.                 {
  11.                     gridArray[i, j].GetComponent<Renderer>().material.color = Color.blue;
  12.                 }
  13.             }
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement