Convert engine types through CultMath.UnityBridge
CultMath has no implicit conversions to or from Vector*, Quaternion or Color, so Assembly-CSharp converts explicitly with ToCultMath/ToUnity at each engine boundary: FieldDriver, GuidedProjectile(Manager), EntityInstance, ActionGameManager, HullCollider, GridObject, ShipInstance, ShieldManager, ItemPickup, FieldTester, PlaceUIElementWorldspace, MapMenuInput, MapRenderer, SectorRenderer and ZoneRenderer. CultMath math calls that were handed Unity vectors now take converted values; Vector3.Scale in FieldDriver becomes a float3 product, and ItemPickup's Vector3.Dot on float3s becomes dot. packages-lock.json records the cultmath git package at f0605367 and demotes com.unity.mathematics to a transitive dependency. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
3dc00e1225
commit
2281793154
17 changed files with 86 additions and 63 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UniRx;
|
||||
using CultMath;
|
||||
using CultMath.UnityBridge;
|
||||
using static CultMath.math;
|
||||
using UnityEngine;
|
||||
using float2 = CultMath.float2;
|
||||
|
|
@ -23,8 +24,8 @@ public class HullCollider : MonoBehaviour
|
|||
Spread = spread,
|
||||
DamageType = damageType,
|
||||
Source = source,
|
||||
TexCoord = texCoord,
|
||||
Direction = direction
|
||||
TexCoord = texCoord.ToCultMath(),
|
||||
Direction = direction.ToCultMath()
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -35,13 +36,13 @@ public class HullCollider : MonoBehaviour
|
|||
Damage = damage,
|
||||
DamageType = damageType,
|
||||
Source = source,
|
||||
Direction = direction
|
||||
Direction = direction.ToCultMath()
|
||||
});
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision other)
|
||||
{
|
||||
Entity.Velocity += ((float3) other.impulse).xz / Time.deltaTime;
|
||||
Entity.Velocity += other.impulse.ToCultMath().xz / Time.deltaTime;
|
||||
}
|
||||
|
||||
public class HullHitEventArgs
|
||||
|
|
|
|||
Loading…
Reference in a new issue