54 lines
1.0 KiB
C#
54 lines
1.0 KiB
C#
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Linq;
|
||
|
|
using System.Text;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace Wing.Gizmos
|
||
|
|
{
|
||
|
|
public class SnapBase : ISnap
|
||
|
|
{
|
||
|
|
protected bool mEnable = false;
|
||
|
|
protected float mPrecision = 0;
|
||
|
|
protected float mTolerance = 0;
|
||
|
|
|
||
|
|
public bool Enable
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
return mEnable;
|
||
|
|
}
|
||
|
|
|
||
|
|
set
|
||
|
|
{
|
||
|
|
mEnable = value;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public float Precision
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
return mPrecision;
|
||
|
|
}
|
||
|
|
|
||
|
|
set
|
||
|
|
{
|
||
|
|
mPrecision = value;
|
||
|
|
CalcTolerance();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
protected virtual void CalcTolerance()
|
||
|
|
{
|
||
|
|
mTolerance = Precision * 0.2f;
|
||
|
|
}
|
||
|
|
|
||
|
|
public virtual bool Snap(Vector3 inVal, ref Vector3 outVal, bool force = false)
|
||
|
|
{
|
||
|
|
outVal = Vector3.zero;
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|