public GridTile(int x, int y) { XCoord = x; YCoord = y; thisTerrainType = GridTerrain.Grass; thisRoadType = RoadType.None; thisNodeType = GridNode.None; thisWaterType = WaterType.None; }
public static bool Raycast(GridTerrain terrain, out RaycastHit hit) { var camRay = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); //Debug.Log(camRay); var collider = terrain.GetComponent <Collider>(); if (collider.Raycast(camRay, out hit, 10000)) { //Handles.DrawLine(camRay.origin, camRay.origin + camRay.direction * hit.distance); return(true); } return(false); }
public override void Draw(Vector2Int userNode, GridTerrain terrain) { Handles.color = Color.blue; if (_showFloodPreview) { var nodes = new SerializedObject(terrain).FindProperty("TerrainData.Nodes"); //Apply(userNode, nodes, terrain, DrawAction); } else { var drawPoint = terrain.transform.TransformPoint(terrain.TerrainData.GetNodePositionUnchecked(userNode.x, userNode.y)); Handles.DrawWireCube(drawPoint, Vector3.one * terrain.NodeGizmoSize); } }
public override void Draw(Vector2Int userNode, GridTerrain terrain) { Handles.color = Color.blue; if (_paintRadius > 0) { for (int x = Mathf.Max(userNode.x - _paintRadius, 0); x < Mathf.Min(userNode.x + _paintRadius + 1, terrain.TerrainData.Width); x++) { for (int y = Mathf.Max(userNode.y - _paintRadius, 0); y < Mathf.Min(userNode.y + _paintRadius + 1, terrain.TerrainData.Height); y++) { var drawPoint = terrain.transform.TransformPoint(terrain.TerrainData.GetNodePositionUnchecked(x, y)); Handles.DrawWireCube(drawPoint, Vector3.one * terrain.NodeGizmoSize); } } } else { var drawPoint = terrain.transform.TransformPoint(terrain.TerrainData.GetNodePositionUnchecked(userNode.x, userNode.y)); Handles.DrawWireCube(drawPoint, Vector3.one * terrain.NodeGizmoSize); } }
public override void Draw(Vector2Int userNode, GridTerrain terrain) { var drawPoint = terrain.transform.TransformPoint(terrain.TerrainData.GetNodePositionUnchecked(userNode.x, userNode.y)); Handles.DrawWireCube(drawPoint, Vector3.one * terrain.NodeGizmoSize); }
/// <summary> /// Draws the brush in the scene view so the user can see it. /// </summary> /// <param name="userNode"></param> /// <param name="terrain"></param> public abstract void Draw(Vector2Int userNode, GridTerrain terrain);