|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.TeamHEC.LocomotionCommotion.Train.Route
public class Route
Field Summary | |
---|---|
Train |
train
|
Constructor Summary | |
---|---|
Route(java.util.ArrayList<Connection> path,
int routeIndex,
float connectionTravelled)
Used to reload an existing route |
|
Route(MapObj startingPos)
Creates an arrayList of connections (a route) for tge train to eventually follow |
Method Summary | |
---|---|
void |
abortRoute()
Removes all connections from the route and resets the train position to the last station it past. |
void |
addConnection(Connection connection)
Adds a new connection to the end of the route, if the player has enough fiel Usually one of the connections return from getAdjacentConnections() |
void |
cancelRoute()
A repeated undo |
java.util.ArrayList<Connection> |
getAdjacentConnections()
Can be used to see which adjacent connections are available to add to an existing route |
float |
getConnectionTravelled()
|
float |
getLengthRemaining()
|
java.util.ArrayList<Connection> |
getRoute()
|
int |
getRouteIndex()
|
Station |
getStation()
|
float |
getTotalLength()
|
com.badlogic.gdx.math.Vector2 |
getTrainPos()
Returns Vector2 containing x and y position of the Train in the Route. |
void |
hideConnectionBlips(Connection connection)
|
void |
hideRouteBlips()
Removes route UI blips from the screen |
boolean |
inStation()
|
boolean |
isComplete()
Set to true when the route reaches an end in update method |
void |
notifyStationPassed()
Notifies all listeners that a station has been passed by a train while completely it's route. |
void |
register(RouteListener newListener)
Adds an object to the listener array |
boolean |
removeConnection()
Removes the latest connection from the route. |
void |
setConnectionTravelled(float travelled)
Can be used to change the position of the train within the route |
void |
setCurrentMapObj(MapObj current)
The currentMapObj the train is positioned at |
void |
setRouteIndex(int index)
Can be used to change the position of the train within the route |
void |
showConnectionBlips(Connection connection)
Creates route UI dots for this connection |
void |
showRouteBlips()
Makes all the white route blips between connections visible, the red dot indicates direction |
void |
unregister(RouteListener removeListener)
Removes an object from the Listener array |
void |
update(float moveBy)
Progressed a train in the route by certain amount - normally it's speed |
void |
updateRouteText()
Updates the text displaying the route information: |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Train train
Constructor Detail |
---|
public Route(MapObj startingPos)
startingPos
- the starting position of the routepublic Route(java.util.ArrayList<Connection> path, int routeIndex, float connectionTravelled)
path
- current route of the trainrouteIndex
- The index used to track progress through an array of connectionsconnectionTravelled
- The distance travelled through that connectionMethod Detail |
---|
public java.util.ArrayList<Connection> getRoute()
public int getRouteIndex()
public boolean isComplete()
public float getConnectionTravelled()
public void setRouteIndex(int index)
index
- the index of the connection to move the train topublic void setConnectionTravelled(float travelled)
travelled
- The position of the train in the current connectionpublic void setCurrentMapObj(MapObj current)
public java.util.ArrayList<Connection> getAdjacentConnections()
public void showRouteBlips()
public void hideRouteBlips()
public void showConnectionBlips(Connection connection)
connection
- the connection to add UI blips topublic void hideConnectionBlips(Connection connection)
connection
- The connection to hide UI blips forpublic void addConnection(Connection connection)
connection
- The connection to be addedpublic boolean removeConnection()
public void abortRoute()
public void cancelRoute()
public void updateRouteText()
public com.badlogic.gdx.math.Vector2 getTrainPos()
public float getTotalLength()
public float getLengthRemaining()
public boolean inStation()
public Station getStation()
public void update(float moveBy)
moveBy
- how much to progress the Train through the route bypublic void register(RouteListener newListener)
public void unregister(RouteListener removeListener)
public void notifyStationPassed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |