Grid

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

using UnityEngine;

using System.Collections;
public class grid : MonoBehaviour {
public float width = 32.0f;
public float height = 32.0f;
public Color color = Color.white;
public Transform tilePrefab;
public TileSet tileSet;
void OnDrawGizmos() {
Vector3 pos = Camera.current.transform.position;
Gizmos.color = this.color;
for (float y = pos.y - 800.0f; y < pos.y + 800f; y += height) {
Gizmos.DrawLine(new Vector3(-100000.0f, Mathf.Floor(y / height) * height,
0f), new Vector3(100000.0f, Mathf.Floor(y / height) * height, 0f));
}

for (float x = pos.x - 1200.0f; x < pos.x + 1200f; x += this.width)


{
Gizmos.DrawLine(new Vector3(Mathf.Floor(x / this.width) * this.width, 1000000, 0f), new Vector3 (Mathf.Floor(x / width) * this.width, 1000000, 0f));
}
}
}

You might also like