Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
HansenDJ committed Apr 4, 2022
2 parents 74469d6 + d03dd31 commit e7053ee
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions Game/Director.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private static void TimerCheckLagandDraw(Timer timer, Player player, SpawnDestor
{
CurrencyHandler.money -= 100;
PlayerStats.playerHealth += 50;
AudioService.PlayAudio(AudioService.healPlayer);
if (PlayerStats.playerHealth > PlayerStats.maxPlayerHealth)
{
PlayerStats.playerHealth = PlayerStats.maxPlayerHealth;
Expand Down
2 changes: 1 addition & 1 deletion Game/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class Player : Character
public void SetPlayerStats()
{
// playerMovementSpeed = 15;
playerHealth = 100;
playerHealth = 300;
SetOffsetColliderWidth(offsetW); // Width offset for player collider box
SetOffsetColliderHeight(offsetH); // Height offset for player collider box
}
Expand Down
2 changes: 2 additions & 0 deletions Game/Powerup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public static void IsHealthHit2Effect()
isCoins = false;
effectTime = 3;
endTime = Director.secondsPassed + effectTime;
AudioService.PlayAudio(AudioService.hurtPlayer);
}
public static void IsHealthHit1Effect()
{
Expand All @@ -63,6 +64,7 @@ public static void IsHealthHit1Effect()
isCoins = false;
effectTime = 3;
endTime = Director.secondsPassed + effectTime;
AudioService.PlayAudio(AudioService.hurtPlayer);
}
public static void IsExplosiveEffect()
{
Expand Down
5 changes: 5 additions & 0 deletions Game/Services/AudioService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public static class AudioService
public static Sound explosion8 = LoadSound("Game/sounds/explosion08.wav");
public static Sound explosion9 = LoadSound("Game/sounds/explosion09.wav");

public static Sound bounceShot = LoadSound("Game/sounds/phaserUp6.mp3");

public static Sound hurtPlayer = LoadSound("Game/sounds/phaserDown1.mp3");
public static Sound healPlayer = LoadSound("Game/sounds/phaserUp2.mp3");


// Constructor
public static void InitSound()
Expand Down
5 changes: 5 additions & 0 deletions Game/SpawnDestroy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ public void SpawnWeapon(int weaponType, int custom = 1,int customX = 0,int custo
_weaponSwitcher.SetCharTexture(ImageService.laser10UpTexture);
playerWeaponList.Add(_weaponSwitcher);
_weaponSwitcher.strength = 5;
AudioService.PlayAudio(AudioService.bounceShot);
}

else{
Expand Down Expand Up @@ -521,6 +522,7 @@ public void PowerUpFall(Player player)

if (PowerUpList[i].ID == 1)
{
AudioService.PlayAudio(AudioService.healPlayer);
PlayerStats.playerHealth = PlayerStats.maxPlayerHealth;
destroyed = true;
} else if (PowerUpList[i].ID == 2)
Expand Down Expand Up @@ -779,6 +781,7 @@ public void OnCollisionActionEnemyWeapon(Player player, Weapon weapon, int index
if (!Powerup.isShielded)
{
PlayerStats.playerHealth -= weapon.strength;
AudioService.PlayAudio(AudioService.hurtPlayer);
}

enemyWeaponsList.RemoveAt(index);
Expand Down Expand Up @@ -847,9 +850,11 @@ public void OnCollisionAction(Player player, int index)
{
if (collisionDetection.CheckCollision(player, enemyList[index]))
{
PlayExplosion();
if (!Powerup.isShielded)
{
PlayerStats.playerHealth -= 50;
AudioService.PlayAudio(AudioService.hurtPlayer);
}

if (enemyList[index].levelOfEnemy == 100)
Expand Down

0 comments on commit e7053ee

Please sign in to comment.