Removed fixed statement when accessing fixed fields.

This commit is contained in:
hondacrx
2019-12-07 11:45:28 -05:00
parent 9c83bc7e82
commit 56819e632d
6 changed files with 39 additions and 63 deletions
@@ -182,39 +182,35 @@ namespace Game.Entities
switch (TriggerType)
{
case AreaTriggerTypes.Sphere:
{
MaxSearchRadius = Math.Max(SphereDatas.Radius, SphereDatas.RadiusTarget);
break;
}
{
MaxSearchRadius = Math.Max(SphereDatas.Radius, SphereDatas.RadiusTarget);
break;
}
case AreaTriggerTypes.Box:
{
fixed (float* ptr = BoxDatas.Extents)
{
MaxSearchRadius = (float) Math.Sqrt(ptr[0] * ptr[0] / 4 + ptr[1] * ptr[1] / 4);
MaxSearchRadius = (float)Math.Sqrt(BoxDatas.Extents[0] * BoxDatas.Extents[0] / 4 + BoxDatas.Extents[1] * BoxDatas.Extents[1] / 4);
break;
}
break;
}
case AreaTriggerTypes.Polygon:
{
if (PolygonDatas.Height <= 0.0f)
PolygonDatas.Height = 1.0f;
foreach (Vector2 vertice in PolygonVertices)
{
float pointDist = vertice.GetLength();
if (PolygonDatas.Height <= 0.0f)
PolygonDatas.Height = 1.0f;
if (pointDist > MaxSearchRadius)
MaxSearchRadius = pointDist;
foreach (Vector2 vertice in PolygonVertices)
{
float pointDist = vertice.GetLength();
if (pointDist > MaxSearchRadius)
MaxSearchRadius = pointDist;
}
break;
}
break;
}
case AreaTriggerTypes.Cylinder:
{
MaxSearchRadius = CylinderDatas.Radius;
break;
}
{
MaxSearchRadius = CylinderDatas.Radius;
break;
}
default:
break;
}