コード例 #1
0
 public GridTile(int x, int y)
 {
     XCoord          = x;
     YCoord          = y;
     thisTerrainType = GridTerrain.Grass;
     thisRoadType    = RoadType.None;
     thisNodeType    = GridNode.None;
     thisWaterType   = WaterType.None;
 }
コード例 #2
0
    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);
    }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
    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);
    }
コード例 #6
0
 /// <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);