From 0954648dbf4cde666988a8cfc9f2a3b4d725fd82 Mon Sep 17 00:00:00 2001 From: meganroxburgh <128758122+meganroxburgh@users.noreply.github.com> Date: Sat, 9 Sep 2023 15:58:29 +1000 Subject: [PATCH] Added in print statements for testing --- .../csse3200/game/components/tasks/MobAttackTask.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java index 7842b8c38..667bc32fa 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobAttackTask.java @@ -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"; @@ -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()); // } @@ -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 -> { @@ -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); } }