26 lines
546 B
C#
26 lines
546 B
C#
using Godot;
|
|
|
|
struct PointMass : IMassive, ILocation
|
|
{
|
|
public float Mass => _massive == null ? _mass : _massive.Mass;
|
|
public Vector3 Position => _spatial.Translation;
|
|
|
|
private IMassive _massive;
|
|
private Spatial _spatial;
|
|
private float _mass;
|
|
|
|
public PointMass(Spatial spatial, IMassive massive)
|
|
{
|
|
_spatial = spatial;
|
|
_massive = massive;
|
|
_mass = 0;
|
|
}
|
|
|
|
public PointMass(Spatial spatial, float mass)
|
|
{
|
|
_spatial = spatial;
|
|
_massive = null;
|
|
_mass = mass;
|
|
}
|
|
}
|