Skip to content

Commit

Permalink
clean up - removed excess prints
Browse files Browse the repository at this point in the history
  • Loading branch information
samsully committed Sep 5, 2023
1 parent f24bf98 commit df15f8f
Showing 1 changed file with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public MobAttackTask(int priority, float maxRange) {
public void start() {
super.start();
startTime = timeSource.getTime();
System.out.println("started mob attack task for " + owner.getEntity());
this.mobPosition = owner.getEntity().getCenterPosition();
this.maxRangePosition.set(mobPosition.x + maxRange, mobPosition.y);
owner.getEntity().getEvents().trigger(IDLE);
Expand All @@ -74,69 +73,53 @@ public void start() {

@Override
public void update() {
System.out.println("mob attack is updating");
updateMobState();

if (mobState == STATE.STOW) {
// System.out.println("updated while STOW");
System.out.println("I'm stow in update");
status = Status.FINISHED;
}
// owner.getEntity().getEvents().trigger("wanderStart");
// } else if (timeSource.getTime() >= endTime) {
// updateMobState();
// endTime = timeSource.getTime() + (INTERVAL * 1000);
// System.out.println("I just updated in state " + mobState);
// }
}

public void updateMobState() {
System.out.println("I'm updating my state");
switch (mobState) {

case IDLE -> {
if (isTargetVisible()) {
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
System.out.println("I just idled and now I'm deploying");
}
}

case DEPLOY -> {
if (isTargetVisible()) {
owner.getEntity().getEvents().trigger(FIRING);
mobState = STATE.FIRING;
System.out.println("I just deployed and now I'm firing");
} else {
owner.getEntity().getEvents().trigger(STOW);
mobState = STATE.STOW;
System.out.println("I just deployed and now I'm stowing");
}
}

case FIRING -> {
if (!isTargetVisible()) {
owner.getEntity().getEvents().trigger(STOW);
mobState = STATE.STOW;
System.out.println("I tried to fire but couldn't see my target");
} else {
owner.getEntity().getEvents().trigger(FIRING);
Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(), new Vector2(0, owner.getEntity().getPosition().y + 1), new Vector2(2f,2f));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x - 0.75), (float) (owner.getEntity().getPosition().y));
ServiceLocator.getEntityService().register(newProjectile);
mobState = STATE.STOW;
System.out.println("I just fired and now stowing");
}
}

case STOW -> {
if (isTargetVisible()) {
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
System.out.println("I just stowed and now I'm deploying");
} else {
owner.getEntity().getEvents().trigger(IDLE);
mobState = STATE.IDLE;
System.out.println("I just stowed and now I'm idling");
}
}
}
Expand Down

0 comments on commit df15f8f

Please sign in to comment.