Ejemplo n.º 1
0
    private void UpdateForCylinder(Vector3 wpos)
    {
        cylinderReticleForEditor.EnableRenderer(true);

        if (Input.GetKey(KeyCode.LeftControl) || Input.GetMouseButtonDown(1))
        {
            firstClickPosition = null;
        }

        if (firstClickPosition.HasValue)
        {
            cylinderReticleForEditor.SetPositionsAndRadius(firstClickPosition.Value, wpos, BrushSize);
        }
        else
        {
            cylinderReticleForEditor.SetPositionsAndRadius(wpos, wpos + Vector3.right, BrushSize);
        }

        if (clicking && Terrain.OperationsManager.IsReadyToComputeAsync)
        {
            if (!firstClickPosition.HasValue)
            {
                firstClickPosition = wpos;
            }
            else
            {
                Terrain.OperationsManager
                .Add(Cylinder.CreateFromUnityWorld(Terrain, dig, firstClickPosition.Value, wpos, BrushSize, voxelType), true)
                .PerformAll(asyncOperations);
                firstClickPosition = null;
            }
        }
    }
Ejemplo n.º 2
0
    protected virtual IOperation CreateOperationFromEditor(Vector3 start, Vector3 end, TerrainToolEditor editor)
    {
        var voxelType = EditorUtils.GetVoxelTypeFromIndex(VoxelTypeIndex, editor.Terrain.VoxelTypeSet);

        return(Cylinder.CreateFromUnityWorld(editor.Terrain, Dig, start, end, Radius, voxelType));
    }