Exemplo n.º 1
0
 public static GameObject getObjectFromPosition(Vector3 position, bool solid = true)
 {
     ///start with a round
     position = RoundVectorToInts(position);
     if (solid)
     {
         if (TheGrid.ContainsKey(position))
         {
             return(TheGrid[position]);
         }
         else
         {
             return(null);
         }
     }
     else
     {
         if (FloorGrid.ContainsKey(position))
         {
             return(FloorGrid[position]);
         }
         else
         {
             return(null);
         }
     }
 }
Exemplo n.º 2
0
 private void AssignNeighbors()
 {
     foreach (var tile in GridDictionary)
     {
         foreach (Vector2Int direction in Utilities.basicDirections)
         {
             if (GridDictionary.ContainsKey(tile.Key + direction))
             {
                 tile.Value.Neighbors.Add(GridDictionary[tile.Key + direction]);
             }
         }
     }
 }