显示ara
This commit is contained in:
@@ -80,6 +80,17 @@ public class GridSelector : MonoBehaviour
|
||||
int hitIndex = Mathf.FloorToInt(pos.x / map.sideWidth) + Mathf.FloorToInt(pos.z / map.sideHeight) * horizontalNumber;
|
||||
return hitIndex;
|
||||
}
|
||||
public Vector2Int getMapGrid(Vector3 pos)
|
||||
{
|
||||
return getMapGrid(new Vector2(pos.x,pos.y));
|
||||
}
|
||||
public Vector2Int getMapGrid(Vector2 pos)
|
||||
{
|
||||
var grid = new Vector2Int();
|
||||
grid.x = Mathf.FloorToInt(pos.x / map.sideWidth);
|
||||
grid.y = Mathf.FloorToInt(pos.y / map.sideHeight);
|
||||
return grid;
|
||||
}
|
||||
private void Awake()
|
||||
{
|
||||
mapRenderer = GetComponent<MeshRenderer>();
|
||||
|
||||
Reference in New Issue
Block a user