Class SpacecraftView
java.lang.Object
gaiasky.scene.view.AbstractView
gaiasky.scene.view.BaseView
gaiasky.scene.view.SpacecraftView
- All Implemented Interfaces:
ISpacecraft
-
Field Summary
FieldsFields inherited from class AbstractView
entityModifier and TypeFieldDescriptionprotected com.badlogic.ashley.core.EntityA reference to the entity. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccel()doublecomputeDirectionUp(double dt, Pair<Vector3D, Vector3D> pair) doublevoidcurrentEnginePower(double power) voiddecreaseThrustFactorIndex(boolean broadcast) doubledrag()protected voidContains actions to take after a new entity has been set.protected voidentityCheck(com.badlogic.ashley.core.Entity entity) Checks whether the given entity is suitable for this view.protected voidThis method is called when the entity of this view is cleared.force()intdoublegetDrag()doubledoubledoublecom.badlogic.gdx.math.QuaterniondoublevoidincreaseThrustFactorIndex(boolean broadcast) booleanbooleanbooleanleveling()doublemass()voidpollKeys(double dt) pos()doublevoidsetCurrentEnginePower(double currentEnginePower) Sets the current engine powervoidsetPitchPower(double pitchp) Sets the current pitch powervoidsetRollPower(double rollp) Sets the current roll powervoidsetThrustFactorIndex(int i, boolean broadcast) voidsetYawPower(double yawp) Sets the current yaw powerfloatsize()voidbooleanstopping()thrust()double[]intdoubleup()vel()Methods inherited from class BaseView
componentsCheck, getBase, getBody, getComponent, getComponentType, getOpacity, getRender, hasCt, isHalfResolutionBuffer, isVisible, isVisible, setColor, setVisible, setVisibleModifier and TypeMethodDescriptionprotected booleancomponentsCheck(com.badlogic.ashley.core.Entity entity) Check whether the current components are the same as the components of the given entity.getBase()getBody()<T extends com.badlogic.ashley.core.Component>
TgetComponent(Class<T> c) floatbooleanbooleanbooleanbooleanisVisible(boolean attributeValue) voidsetColor(float[] color) voidsetVisible(boolean visible) voidsetVisible(boolean visible, String name) Methods inherited from class AbstractView
check, clearEntity, getEntity, isEmpty, isValid, setEntityModifier and TypeMethodDescriptionprotected voidcheck(com.badlogic.ashley.core.Entity entity, com.badlogic.ashley.core.ComponentMapper mapper, Class<? extends com.badlogic.ashley.core.Component> componentClass) Checks whether an entity has a component, and throws aRuntimeExceptionif it does not.voidRemoves the entity (if any) of this view and sets all component references to null.com.badlogic.ashley.core.EntityReturns the current entity under this view.booleanisEmpty()Checks whether an entity is set in this view.booleanisValid()Checks whether the entity is valid, i.e., it is not null and has at least one component.voidsetEntity(com.badlogic.ashley.core.Entity entity) Sets the entity behind this view.
-
Field Details
-
engine
-
coordinates
-
-
Constructor Details
-
SpacecraftView
public SpacecraftView()
-
-
Method Details
-
entityCheck
protected void entityCheck(com.badlogic.ashley.core.Entity entity) Description copied from class:AbstractViewChecks whether the given entity is suitable for this view. This method should throw aRuntimeExceptionif the entity is not suitable.- Overrides:
entityCheckin classBaseView- Parameters:
entity- The entity.
-
entityChanged
protected void entityChanged()Description copied from class:AbstractViewContains actions to take after a new entity has been set. This method is typically used to initialize the view components.- Overrides:
entityChangedin classBaseView
-
entityCleared
protected void entityCleared()Description copied from class:AbstractViewThis method is called when the entity of this view is cleared. It should set all component references to null.- Overrides:
entityClearedin classBaseView
-
isStopping
public boolean isStopping() -
isStabilising
public boolean isStabilising() -
getMachines
-
getCurrentMachine
public int getCurrentMachine() -
force
- Specified by:
forcein interfaceISpacecraft
-
accel
- Specified by:
accelin interfaceISpacecraft
-
pos
-
vel
- Specified by:
velin interfaceISpacecraft
-
direction
- Specified by:
directionin interfaceISpacecraft
-
up
- Specified by:
upin interfaceISpacecraft
-
thrust
- Specified by:
thrustin interfaceISpacecraft
-
size
public float size() -
getResponsiveness
public double getResponsiveness() -
getDrag
public double getDrag() -
currentEnginePower
public double currentEnginePower()- Specified by:
currentEnginePowerin interfaceISpacecraft
-
currentEnginePower
public void currentEnginePower(double power) - Specified by:
currentEnginePowerin interfaceISpacecraft
-
thrustMagnitude
public double thrustMagnitude()- Specified by:
thrustMagnitudein interfaceISpacecraft
-
thrustFactor
public double[] thrustFactor()- Specified by:
thrustFactorin interfaceISpacecraft
-
relativisticSpeedCap
public double relativisticSpeedCap()- Specified by:
relativisticSpeedCapin interfaceISpacecraft
-
drag
public double drag()- Specified by:
dragin interfaceISpacecraft
-
mass
public double mass()- Specified by:
massin interfaceISpacecraft
-
thrustFactorIndex
public int thrustFactorIndex()- Specified by:
thrustFactorIndexin interfaceISpacecraft
-
leveling
public boolean leveling()- Specified by:
levelingin interfaceISpacecraft
-
stopping
public boolean stopping()- Specified by:
stoppingin interfaceISpacecraft
-
getRotationQuaternion
public com.badlogic.gdx.math.Quaternion getRotationQuaternion() -
getCoordinates
-
getYawPower
public double getYawPower() -
setYawPower
public void setYawPower(double yawp) Sets the current yaw power- Parameters:
yawp- The yaw power in [-1..1]
-
getPitchPower
public double getPitchPower() -
setPitchPower
public void setPitchPower(double pitchp) Sets the current pitch power- Parameters:
pitchp- The pitch power in [-1..1]
-
getRollPower
public double getRollPower() -
setRollPower
public void setRollPower(double rollp) Sets the current roll power- Parameters:
rollp- The roll power in [-1..1]
-
setCurrentEnginePower
public void setCurrentEnginePower(double currentEnginePower) Sets the current engine power- Parameters:
currentEnginePower- The power in [-1..1]
-
stopAllMovement
public void stopAllMovement()- Specified by:
stopAllMovementin interfaceISpacecraft
-
increaseThrustFactorIndex
public void increaseThrustFactorIndex(boolean broadcast) -
decreaseThrustFactorIndex
public void decreaseThrustFactorIndex(boolean broadcast) -
setThrustFactorIndex
public void setThrustFactorIndex(int i, boolean broadcast) -
computeDirectionUp
-
pollKeys
public void pollKeys(double dt)
-