Skip to content

Commit

Permalink
Added in print statements for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
meganroxburgh committed Sep 9, 2023
1 parent cd4895e commit 0954648
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
public class MobAttackTask extends DefaultTask implements PriorityTask {
private static final int INTERVAL = 1; // time interval to scan for towers in
private static final short TARGET = PhysicsLayer.OBSTACLE; // mobs detecting for towers
private static final short TARGET = PhysicsLayer.HUMANS; // mobs detecting for towers
// ^ fix this

// private static final String STOW = "stowStart";
Expand Down Expand Up @@ -91,7 +91,6 @@ public void update() {
public void updateMobState() {
// TouchAttackComponent attackComp = owner.getEntity().getComponent(TouchAttackComponent.class);
CombatStatsComponent statsComp = owner.getEntity().getComponent(CombatStatsComponent.class);
System.out.println(owner.getEntity().getId() + " health: " + statsComp.getHealth());
// if (statsComp != null) {
// System.out.println("is the target visible " + isTargetVisible());
// }
Expand All @@ -102,10 +101,14 @@ public void updateMobState() {

case IDLE -> {
if (isTargetVisible()) {
System.out.println("IDLE: target visible for " + owner.getEntity().getId());
// targets detected in idle mode - start deployment
//owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.FIRING;
}
else {
System.out.println("IDLE: target not visible for " + owner.getEntity().getId());
}
}

// case DEPLOY -> {
Expand All @@ -125,12 +128,14 @@ public void updateMobState() {
if (!isTargetVisible()) {
//owner.getEntity().getEvents().trigger(STOW);
mobState = STATE.IDLE;
System.out.println("FIRING: target not visible for " + owner.getEntity().getId());
} else {
//owner.getEntity().getEvents().trigger(FIRING);
Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.PLAYER, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y));
ServiceLocator.getEntityService().register(newProjectile);
// mobState = STATE.IDLE;
System.out.println("FIRING: target visible for " + owner.getEntity().getId());
owner.getEntity().getEvents().trigger(FIRING);
}
}
Expand Down

0 comments on commit 0954648

Please sign in to comment.