56 lines
1 KiB
C#
56 lines
1 KiB
C#
using System;
|
|
using System.Numerics;
|
|
using System.Text.Json.Serialization;
|
|
using SmartNav.Model.Converter;
|
|
|
|
namespace Questionable.Model.Gathering;
|
|
|
|
public sealed class GatheringLocation
|
|
{
|
|
[JsonIgnore]
|
|
public Guid InternalId { get; } = Guid.NewGuid();
|
|
|
|
[JsonConverter(typeof(VectorConverter))]
|
|
public Vector3 Position { get; set; }
|
|
|
|
public int? MinimumAngle { get; set; }
|
|
|
|
public int? MaximumAngle { get; set; }
|
|
|
|
public float? MinimumDistance { get; set; }
|
|
|
|
public float? MaximumDistance { get; set; }
|
|
|
|
public bool IsCone()
|
|
{
|
|
int num = ((!MinimumAngle.HasValue) ? (-443145177) : (-443145178));
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -443145177;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
return false;
|
|
case 1:
|
|
return MaximumAngle.HasValue;
|
|
case 2:
|
|
goto IL_005f;
|
|
}
|
|
continue;
|
|
IL_005f:
|
|
num = -443145178;
|
|
}
|
|
}
|
|
|
|
public float CalculateMinimumDistance()
|
|
{
|
|
return MinimumDistance ?? 1f;
|
|
}
|
|
|
|
public float CalculateMaximumDistance()
|
|
{
|
|
return MaximumDistance ?? 3f;
|
|
}
|
|
}
|