From 43539c5c32b8abc83cc5453828b0f2af36ce694a Mon Sep 17 00:00:00 2001 From: freshc0w <121275444+freshc0w@users.noreply.github.com> Date: Tue, 10 Oct 2023 16:13:39 +1000 Subject: [PATCH] Fix dodge dragon knight tasks not appearing in game --- .../com/csse3200/game/components/tasks/MobDodgeTask.java | 8 +++++--- .../com/csse3200/game/entities/factories/NPCFactory.java | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobDodgeTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobDodgeTask.java index 7cee70082..b4c4fa3ea 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobDodgeTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobDodgeTask.java @@ -1,6 +1,8 @@ package com.csse3200.game.components.tasks; import com.badlogic.gdx.math.Vector2; +import com.csse3200.game.components.tasks.MobTask.MobTask; +import com.csse3200.game.components.tasks.MobTask.MobType; import com.csse3200.game.services.GameTime; import com.csse3200.game.services.ServiceLocator; @@ -14,7 +16,7 @@ * "dodgeIncomingEntity" event to the attached entity. *

*/ -public class MobDodgeTask extends MobWanderTask { +public class MobDodgeTask extends MobTask { private final int priority; // active priority @@ -34,8 +36,8 @@ public class MobDodgeTask extends MobWanderTask { * @param waitTime How long in seconds to wait between wandering. * @param priority Priority level compared to other added tasks. */ - public MobDodgeTask(Vector2 wanderRange, float waitTime, int priority) { - super(wanderRange, waitTime); + public MobDodgeTask(MobType mobType, int priority) { + super(mobType); this.priority = priority; timeSource = ServiceLocator.getTimeSource(); diff --git a/source/core/src/main/com/csse3200/game/entities/factories/NPCFactory.java b/source/core/src/main/com/csse3200/game/entities/factories/NPCFactory.java index 94663d076..d62b15945 100644 --- a/source/core/src/main/com/csse3200/game/entities/factories/NPCFactory.java +++ b/source/core/src/main/com/csse3200/game/entities/factories/NPCFactory.java @@ -462,7 +462,8 @@ public static Entity createSplittingXenoGrunt(int health) { .addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, 0.25f)); // * TEMPORARY TESTING FOR PROJECTILE DODGING - splitXenoGrunt.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); + splitXenoGrunt.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(MobType.DRAGON_KNIGHT, 5)); + // splitXenoGrunt.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); return splitXenoGrunt; } @@ -489,8 +490,9 @@ public static Entity createDodgingDragonKnight(int health) { Entity dodgeKnight = createDragonKnight(health); dodgeKnight.addComponent(new DodgingComponent(PhysicsLayer.PROJECTILE, 0.25f)); - dodgeKnight.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); - + // dodgeKnight.getComponent(AITaskComponent.class).addTask(new MobDodgeTask(new Vector2(2f, 2f), 2f, 5)); + dodgeKnight.getComponent(AITaskComponent.class). + addTask(new MobDodgeTask(MobType.DRAGON_KNIGHT, 5)); PhysicsUtils.setScaledCollider(dodgeKnight, 0.3f, 0.7f); dodgeKnight.setScale(0.3f, 0.7f);