Skip to content

Commit

Permalink
Merge branch 'Projectile-Animation' into Team-1--Projectiles
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyle1 committed Sep 11, 2023
2 parents 0f02b04 + 4792674 commit 4387220
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package com.csse3200.game.components.npc;

import com.badlogic.gdx.audio.Sound;
import com.csse3200.game.components.Component;
import com.csse3200.game.rendering.AnimationRenderComponent;
import com.csse3200.game.services.ServiceLocator;

/**
* This class listens to events relevant to a ghost entity's state and plays the animation when one
* of the events is triggered.
*/
public class XenoAnimationController extends Component {
private static final String COLLISION_SFX = "sounds/projectiles/on_collision.mp3";
Sound onCollisionSound = ServiceLocator.getResourceService().getAsset(
COLLISION_SFX, Sound.class);
AnimationRenderComponent animator;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void animatePrepWalk() {
*/
void animateSingleFiring() {
animator.startAnimation(FIRE_SINGLE_ANIM);
fireSingleSound.play();
// fireSingleSound.play();
}

/**
Expand All @@ -112,7 +112,7 @@ void animateSingleFiring() {
*/
void animateFiringAuto() {
animator.startAnimation(FIRE_AUTO_ANIM);
fireAutoSound.play();
// fireAutoSound.play();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class ProjectileDestructors {
*/
public static Entity destroyProjectile(Entity projectile) {
projectile.dispose();
projectile.getEvents().trigger("");
return projectile;
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class ProjectileFactoryTest {
"images/projectiles/mobKing_projectile.atlas",
"images/projectiles/engineer_projectile.atlas",
"images/projectiles/stun_effect.atlas",
"images/projectiles/burn_effect.atlas"
"images/projectiles/burn_effect.atlas",
"images/projectiles/snow_ball.atlas"
};

private final String[] animations = {
Expand Down Expand Up @@ -249,5 +250,27 @@ public void testBurnProjectileAnimationController() {
assertNotNull(burnProjectile.getComponent(BurnEffectProjectileAnimationController.class),
"Burn Projectile does not have Animation Controller");
}

@Test
public void testSlowProjectileCreation() {
Entity slowProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.NPC, new Vector2(0.1f,
0.1f), new Vector2(2,2), ProjectileEffects.SLOW, false);
assertNotNull(slowProjectile, "slowProjectile is null");
}

@Test
public void testSlowProjectileAnimationRenderComponent() {
Entity slowProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.NPC, new Vector2(0.1f,01f),
new Vector2(2,2), ProjectileEffects.SLOW, false);
assertNotNull(slowProjectile.getComponent(AnimationRenderComponent.class),
"Slow Projectile does not have AnimationRenderComponent");
}
@Test
public void testSlowProjectileAnimationController() {
Entity slowProjectile = ProjectileFactory.createEffectProjectile(PhysicsLayer.TOWER, new Vector2(0.1f, 0.1f)
, new Vector2(2,2), ProjectileEffects.SLOW, false);
assertNotNull(slowProjectile.getComponent(SnowBallProjectileAnimationController.class),
"Slow Projectile does not have Animation Controller");
}
}

0 comments on commit 4387220

Please sign in to comment.