-
Notifications
You must be signed in to change notification settings - Fork 1
Enemy NPC Test Cases
The following components are being tested as part of the enemy creation and combat feature:
CreateMonkey()
: Creates monkey entity
createchicken()
: Creates chicken entity
createFrog
: Creates Frog entity
createBaseEnemy
: Creates Base Enemy
create()
: Initialises the component and sets up event listeners
animateSpawn()
: Plays the "spawn" animation
animateChaseLeft()
: Plays the "walk" animation and flips the sprite to face left
animateChaseRight()
: Plays the "walk" animation and flips the sprite to face right
animateWanderLeft()
: Plays the "walk" animation and flips the sprite to face left
animateWanderRight()
: Plays the "walk" animation and flips the sprite to face right
create()
: Initialises the component and sets up event listeners
animateWanderLeft()
: Plays the "float" animation and flips the sprite to face left
animateWanderRight()
: Plays the "float" animation and flips the sprite to face right
animateChaseLeft()
: Plays the "angry_float" animation and flips the sprite to face left
animateChaseRight()
: Plays the "angry_float" animation and flips the sprite to face right
create()
: Initialises the component and sets up event listeners
animateRunDown()
: Plays the "run_down" animation, likely used when the character is running downwards
animateRunUp()
: Plays the "run_up" animation, likely used when the character is running upwards
animateRunLeft()
: Plays the "run_left" animation, likely used when the character is running to the left
animateRunRight()
: Plays the "run_right" animation, likely used when the character is running to the right
animateRunLeftDown()
: Plays the "run_left_down" animation, likely used when the character is running diagonally down to the left
animateRunRightDown()
: Plays the "run_right_down" animation, likely used when the character is running diagonally down to the right
animateRunLeftUp()
: Plays the "run_left_up" animation, likely used when the character is running diagonally up to the left
animateRunRightUp()
: Plays the "run_right_up" animation, likely used when the character is running diagonally up to the right
SpawnTask(Vector2 spawnPosition, float spawnDuration)
: Constructor for the SpawnTask class, initialises the task with the spawn position and duration
getSpawnPosition()
: Returns the position where the entity will be spawned
getSpawnDuration()
: Returns the duration of the spawn task
getElapsedTime()
: Returns the elapsed time since the spawn task started
getPriority()
: Returns the priority of this task, with higher values indicating higher priority
start()
: Starts the spawn task, positioning the entity at the spawn location and triggering the "spawnChicken" event
completeTask()
: Completes the spawn task, stopping it and cleaning up if necessary
stop()
: Stops the spawn task, cleaning up if necessary. Inherits from DefaultTask.
ProximityComponent()
: Constructor for the ProximityComponent
update()
: Updates the component's state based on the entity's position relative to the target
setupSpawnAnimation(Entity entity)
: Sets up the spawn animation for the given entity.
View Touch Attack Component Tests
TouchAttackComponent()
: Constructor for the TouchAttackComponent
create()
: Creates the component and sets up event listeners
onCollisionStart
: Handles the "collisionStart" event
Tests the creation of projectiles, which is currently only the banana, to ensure they are instantiated correctly with the necessary components.
-
TestBananaCreation()
: Tests the creation of a banana projectile. -
TestBananaIsEntity()
: Verifies that the created banana is an instance of theEntity
class. -
TestBananaHasComponents()
: Ensures that the banana has all required components, such asPhysicsComponent
,PhysicsMovementComponent
,BananaAnimationController
,ProjectileAttackComponent
,HitboxComponent
, andColliderComponent
.
Tests the TouchAttackComponent
to verify that it correctly handles collision-based attack logic.
-
shouldNotAttackOtherLayer()
: Verifies that the attack does not occur if the target entity is on a different physics layer. -
shouldNotAttackWithoutCombatComponent()
: Ensures that the attack is ignored if the target entity does not have aCombatStatsComponent
.
Tests the ShootTask
to verify its behaviour for firing projectiles when within range and the correct wait time has elapsed.
-
shouldShootWhenInRangeAndWaitTimeElapsed()
: Verifies that theShootTask
fires a projectile (triggers the "FireBanana" event) when the target is within range and the wait time has passed. -
shouldShootOnlyWhenInDistance()
: Ensures that theShootTask
only fires when the target is within a specified distance range and does not shoot when the target is too far away.