using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using BITKit; using Unity.Collections.LowLevel.Unsafe; using Unity.Mathematics; using UnityEngine; // ReSharper disable UnassignedField.Local namespace BITFactory.Cutting { [Serializable] public sealed class CuttingScriptablePointBrush : CuttingToolBrush { public override string Name=> "程序点切削"; public override string Description => "输入点切削的位置和半径,点击确认进行切削\n按鼠标左键在模型上进行采样"; [Export("位置")] private Vector3 point; [Export("半径")] private float radius = 0.01f; [Export("确认")] private void Release() { if (radius is 0) { cuttingTool.Execute(new CuttingPointCommand() { PlaneNormal = Vector3.up, PlanePoint = point }); } else { cuttingTool.Execute(new CuttingSphereCommand() { PlaneNormal = Vector3.up, PlanePoint = point, Radius = radius }); } } public override void OnStateUpdate(float deltaTime) { base.OnStateUpdate(deltaTime); cuttingTool.CutPlantSphere(true, Vector3.up, point, radius); } public override void ReleasePoint(float3 normal, float3 point) { base.ReleasePoint(normal, point); this.point = point; } } }