public class EllipticalOrbit extends Object implements OrbitAPI
Modifier and Type | Field and Description |
---|---|
protected float |
currentAngle |
protected SectorEntityToken |
entity |
protected SectorEntityToken |
focus |
protected float |
offsetCos |
protected float |
offsetSin |
protected float |
orbitAngle |
protected float |
orbitHeight |
protected float |
orbitSpeed |
protected float |
orbitWidth |
Constructor and Description |
---|
EllipticalOrbit(SectorEntityToken focus,
float startAngle,
float orbitWidth,
float orbitHeight,
float orbitAngle,
float daysPerOrbit)
Creates an elliptical orbit around a focus object.
|
Modifier and Type | Method and Description |
---|---|
void |
advance(float amount)
Called by Starsector itself - you can ignore this.
|
Vector2f |
computeCurrentLocation() |
float |
getAngle()
Returns the current angle along the orbital path of the orbiting entity.
|
SectorEntityToken |
getFocus()
Returns the object we are orbiting.
|
float |
getOrbitalPeriod() |
float |
getOrbitAngle()
Returns the offset angle of the ellipsis used as a path.
|
float |
getOrbitHeight()
Returns the height of the ellipsis used as a path.
|
float |
getOrbitWidth()
Returns the width of the ellipsis used as a path.
|
OrbitAPI |
makeCopy() |
void |
setAngle(float angle)
Explicitly sets where along our orbital path we should be.
|
void |
setEntity(SectorEntityToken entity)
Called by Starsector itself - you can ignore this.
|
protected final SectorEntityToken focus
protected final float orbitAngle
protected final float orbitWidth
protected final float orbitHeight
protected final float orbitSpeed
protected final float offsetSin
protected final float offsetCos
protected SectorEntityToken entity
protected float currentAngle
public EllipticalOrbit(SectorEntityToken focus, float startAngle, float orbitWidth, float orbitHeight, float orbitAngle, float daysPerOrbit)
focus
- What to orbit around.startAngle
- The angle (in degrees) that the orbit will begin at.
0 degrees = right - this is not relative to
orbitAngle
.orbitWidth
- The width of the ellipse that makes up the orbital
path.orbitHeight
- The height of the ellipse that makes up the orbital
path.orbitAngle
- The angular offset of the ellipse that makes up the
orbital path.daysPerOrbit
- How long it should take for us to make one orbit
around focus
.public float getAngle()
public float getOrbitWidth()
public float getOrbitHeight()
public float getOrbitAngle()
public void setAngle(float angle)
angle
- The angle (in degrees) along the orbital path we should be
moved to.public SectorEntityToken getFocus()
getFocus
in interface OrbitAPI
SectorEntityToken
we are orbiting around.public void setEntity(SectorEntityToken entity)
setEntity
in interface OrbitAPI
entity
- entity that's doing the orbiting.public void advance(float amount)
advance
in interface OrbitAPI
public OrbitAPI makeCopy()
makeCopy
in interface OrbitAPI
public Vector2f computeCurrentLocation()
computeCurrentLocation
in interface OrbitAPI
public float getOrbitalPeriod()
getOrbitalPeriod
in interface OrbitAPI