follow-up on splitting F class

This commit is contained in:
in0finite 2022-09-30 18:14:48 +02:00
parent 4ab78a9a7d
commit 54b7984eb1
5 changed files with 20 additions and 9 deletions

View file

@ -497,7 +497,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
// Quaternion convertRot = Quaternion.Euler (WeaponsManager.Instance.AIMWITHARM_upperArmEndRotationEulers);
// head rotation
Vector3 clampedAimDir = F.ClampDirection (aimDir, player.transform.forward, WeaponsManager.Instance.AIMWITHARM_maxHeadRotationAngle);
Vector3 clampedAimDir = MathUtils.ClampDirection (aimDir, player.transform.forward, WeaponsManager.Instance.AIMWITHARM_maxHeadRotationAngle);
Quaternion headRot = isAimingBack ? player.transform.rotation : Quaternion.LookRotation (clampedAimDir);
// headRot = Quaternion.Lerp( model.Head.rotation, headRot, 0.3f);

View file

@ -50,7 +50,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
initialLocalRot = tr.localRotation;
}
parentBody = (Rigidbody)F.GetTopmostParentComponent<Rigidbody>(tr);
parentBody = (Rigidbody)tr.GetTopmostParentComponent<Rigidbody>();
initialPos = tr.localPosition;
}

View file

@ -91,11 +91,22 @@ namespace SanAndreasUnity.Importing.Vehicles
_sParsers.Add(attrib.Value, (s, instance) =>
{
set.Invoke(instance, new object[] { prop.PropertyType != typeof(string) ? Convert.ChangeType(attrib.IsHexNumber ? s.FromHex(prop.PropertyType, CultureInfo.InvariantCulture) : s, prop.PropertyType, CultureInfo.InvariantCulture) : s });
set.Invoke(instance, new object[] { prop.PropertyType != typeof(string) ? Convert.ChangeType(attrib.IsHexNumber ? FromHex(s, prop.PropertyType, CultureInfo.InvariantCulture) : s, prop.PropertyType, CultureInfo.InvariantCulture) : s });
});
}
}
private static object FromHex(string hexString, Type type, CultureInfo info)
{
var argTypes = new[] { typeof(string), typeof(NumberStyles), typeof(IFormatProvider) };
var convert = type.GetMethod("Parse",
BindingFlags.Static | BindingFlags.Public,
null, argTypes, null);
return convert.Invoke(null, new object[] { hexString, NumberStyles.HexNumber, info });
}
protected Entry(string line)
{
if (_sParsers == null)

View file

@ -498,7 +498,7 @@ namespace SanAndreasUnity.UI {
Rect texCoords = new Rect(visibleMapRect.x / mapTexture.width, visibleMapRect.y / mapTexture.height,
visibleMapRect.width / mapTexture.width, visibleMapRect.height / mapTexture.height);
texCoords = F.Clamp01 (texCoords);
texCoords = MathUtils.Clamp01 (texCoords);
// adjust display rect
@ -690,7 +690,7 @@ namespace SanAndreasUnity.UI {
foreach (PathNodeId nodeId in m_pathToWaypoint)
{
Vector2 pos = MiniMap.WorldPosToMapPos(NodeReader.GetNodeById(nodeId).Position);
if (GetMapItemRenderRect(F.CreateRect(pos, Vector2.one * 2), out Rect renderRect))
if (GetMapItemRenderRect(MathUtils.CreateRect(pos, Vector2.one * 2), out Rect renderRect))
GUIUtils.DrawRect(renderRect, Color.yellow);
}
}
@ -701,7 +701,7 @@ namespace SanAndreasUnity.UI {
foreach (Vector3 worldPos in m_navMeshPathToWaypoint)
{
Vector2 pos = MiniMap.WorldPosToMapPos(worldPos);
if (GetMapItemRenderRect(F.CreateRect(pos, Vector2.one * 2), out Rect renderRect))
if (GetMapItemRenderRect(MathUtils.CreateRect(pos, Vector2.one * 2), out Rect renderRect))
GUIUtils.DrawRect(renderRect, Color.yellow);
}
}
@ -782,7 +782,7 @@ namespace SanAndreasUnity.UI {
public void DrawItemOnMap( Texture2D itemTexture, Vector2 mapPos, int itemSize ) {
this.DrawItemOnMap (itemTexture, F.CreateRect (mapPos, Vector2.one * itemSize));
this.DrawItemOnMap (itemTexture, MathUtils.CreateRect (mapPos, Vector2.one * itemSize));
}
@ -798,7 +798,7 @@ namespace SanAndreasUnity.UI {
Vector2 mapPos = MiniMap.WorldPosToMapPos (worldPos);
this.DrawItemOnMapRotated (itemTexture, F.CreateRect (mapPos, Vector2.one * itemSize), worldDir);
this.DrawItemOnMapRotated (itemTexture, MathUtils.CreateRect (mapPos, Vector2.one * itemSize), worldDir);
}

@ -1 +1 @@
Subproject commit 6efa03e952899d656fe731a820c9057a5dc5b129
Subproject commit a4a8d70135f8a0f6ba3296fd790bba5cfbffcbb1