refactor FindGroundParams

This commit is contained in:
in0finite 2019-11-22 17:21:17 +01:00
parent 85cd5867a6
commit a1751c7ba4

View file

@ -105,9 +105,16 @@ namespace SanAndreasUnity.Behaviours
public struct FindGroundParams
{
public bool tryFromAbove;
public float raycastDistance;
public FindGroundParams(bool tryFromAbove = true, float raycastDistance = 1000)
{
this.tryFromAbove = tryFromAbove;
this.raycastDistance = raycastDistance;
}
public static FindGroundParams DefaultBasedOnLoadedWorld => new FindGroundParams((null == Cell.Instance || Cell.Instance.HasExterior));
public static FindGroundParams Default => new FindGroundParams(){tryFromAbove = true};
public static FindGroundParams DefaultBasedOnLoadedWorld => new FindGroundParams(){tryFromAbove = (null == Cell.Instance || Cell.Instance.HasExterior)};
}
@ -468,7 +475,7 @@ namespace SanAndreasUnity.Behaviours
Vector3 t = this.transform.position;
t.y = 150;
this.transform.position = t;
this.FindGround(FindGroundParams.Default);
this.FindGround(new FindGroundParams());
}