mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-19 18:46:43 +00:00
execution time added v.2
I noticed I should place the execution time event after the walking action in update
This commit is contained in:
parent
89f53a159a
commit
213ea4a3af
@ -173,13 +173,6 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Me
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
int executionTime = timer.getTime();
|
|
||||||
if(executionTime > time && currentAction != Action.IDLE){
|
|
||||||
GameEvent event1 = new ExecutionTimeEvent(this, executionTime - time);
|
|
||||||
GameServer.INSTANCE.getEventDispatcher().dispatch(event1);
|
|
||||||
}
|
|
||||||
time = executionTime;
|
|
||||||
|
|
||||||
if (currentAction == Action.WALKING) {
|
if (currentAction == Action.WALKING) {
|
||||||
if (spendEnergy(100)) {
|
if (spendEnergy(100)) {
|
||||||
if (!incrementLocation()) {
|
if (!incrementLocation()) {
|
||||||
@ -194,6 +187,13 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Me
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int executionTime = timer.getTime();
|
||||||
|
if(executionTime > time && currentAction != Action.IDLE){
|
||||||
|
GameEvent event1 = new ExecutionTimeEvent(this, executionTime - time);
|
||||||
|
GameServer.INSTANCE.getEventDispatcher().dispatch(event1);
|
||||||
|
}
|
||||||
|
time = executionTime;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CurrentAction is set during the code execution and this function is called right after
|
* CurrentAction is set during the code execution and this function is called right after
|
||||||
* If no action as been set, the action sent to the client is the action in currentAction that
|
* If no action as been set, the action sent to the client is the action in currentAction that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user