add IRcRand for unity3d

This commit is contained in:
ikpil 2023-07-14 22:42:48 +09:00
parent 7846d80528
commit ee5d3fd8c7
3 changed files with 12 additions and 5 deletions

View File

@ -2,7 +2,7 @@
namespace DotRecast.Core namespace DotRecast.Core
{ {
public class FRand public class FRand : IRcRand
{ {
private readonly Random _r; private readonly Random _r;

View File

@ -0,0 +1,7 @@
namespace DotRecast.Core
{
public interface IRcRand
{
float Next();
}
}

View File

@ -78,7 +78,7 @@ namespace DotRecast.Detour
/// @param[out] randomRef The reference id of the random location. /// @param[out] randomRef The reference id of the random location.
/// @param[out] randomPt The random location. /// @param[out] randomPt The random location.
/// @returns The status flags for the query. /// @returns The status flags for the query.
public DtStatus FindRandomPoint(IDtQueryFilter filter, FRand frand, out long randomRef, out RcVec3f randomPt) public DtStatus FindRandomPoint(IDtQueryFilter filter, IRcRand frand, out long randomRef, out RcVec3f randomPt)
{ {
randomRef = 0; randomRef = 0;
randomPt = RcVec3f.Zero; randomPt = RcVec3f.Zero;
@ -199,7 +199,7 @@ namespace DotRecast.Detour
* @return Random location * @return Random location
*/ */
public DtStatus FindRandomPointAroundCircle(long startRef, RcVec3f centerPos, float maxRadius, public DtStatus FindRandomPointAroundCircle(long startRef, RcVec3f centerPos, float maxRadius,
IDtQueryFilter filter, FRand frand, out long randomRef, out RcVec3f randomPt) IDtQueryFilter filter, IRcRand frand, out long randomRef, out RcVec3f randomPt)
{ {
return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, NoOpPolygonByCircleConstraint.Noop, out randomRef, out randomPt); return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, NoOpPolygonByCircleConstraint.Noop, out randomRef, out randomPt);
} }
@ -220,13 +220,13 @@ namespace DotRecast.Detour
* @return Random location * @return Random location
*/ */
public DtStatus FindRandomPointWithinCircle(long startRef, RcVec3f centerPos, float maxRadius, public DtStatus FindRandomPointWithinCircle(long startRef, RcVec3f centerPos, float maxRadius,
IDtQueryFilter filter, FRand frand, out long randomRef, out RcVec3f randomPt) IDtQueryFilter filter, IRcRand frand, out long randomRef, out RcVec3f randomPt)
{ {
return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, StrictPolygonByCircleConstraint.Strict, out randomRef, out randomPt); return FindRandomPointAroundCircle(startRef, centerPos, maxRadius, filter, frand, StrictPolygonByCircleConstraint.Strict, out randomRef, out randomPt);
} }
public DtStatus FindRandomPointAroundCircle(long startRef, RcVec3f centerPos, float maxRadius, public DtStatus FindRandomPointAroundCircle(long startRef, RcVec3f centerPos, float maxRadius,
IDtQueryFilter filter, FRand frand, IPolygonByCircleConstraint constraint, IDtQueryFilter filter, IRcRand frand, IPolygonByCircleConstraint constraint,
out long randomRef, out RcVec3f randomPt) out long randomRef, out RcVec3f randomPt)
{ {
randomRef = startRef; randomRef = startRef;