Skip to content

Commit

Permalink
Linked SFX
Browse files Browse the repository at this point in the history
  • Loading branch information
zackkraemer2 committed Jun 14, 2023
1 parent 8fa5265 commit 7ae74dd
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
26 changes: 21 additions & 5 deletions Assets/Scenes/Game.unity
Original file line number Diff line number Diff line change
Expand Up @@ -54385,7 +54385,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.size
value: 28
value: 29
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[0].clip
Expand Down Expand Up @@ -54619,6 +54619,14 @@ PrefabInstance:
propertyPath: sfxClips.Array.data[27].name
value: Death
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[28].clip
value:
objectReference: {fileID: 8300000, guid: 972d69b6bdf030342b6b02d5fa0d5192, type: 3}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[28].name
value: Coin
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[2].pitch
value: 1
Expand Down Expand Up @@ -54653,7 +54661,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[0].volume
value: 1
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[10].pitch
Expand Down Expand Up @@ -54697,7 +54705,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[1].volume
value: 1
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[20].pitch
Expand Down Expand Up @@ -54732,12 +54740,16 @@ PrefabInstance:
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[2].volume
propertyPath: sfxClips.Array.data[28].pitch
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[2].volume
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[3].volume
value: 1
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[4].volume
Expand Down Expand Up @@ -54835,6 +54847,10 @@ PrefabInstance:
propertyPath: sfxClips.Array.data[27].volume
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5174039956999126179, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: sfxClips.Array.data[28].volume
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9045642716972913436, guid: c4b261588946c3647915224fbbdb351c, type: 3}
propertyPath: m_Name
value: AudioManager
Expand Down
7 changes: 6 additions & 1 deletion Assets/Scripts/Ant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ protected IEnumerator Attack(GameObject targetObject)
yield return new WaitForSeconds(entityData.attackCooldown);
toolAnimator.SetTrigger("Attack");
AudioManager.instance.PlaySFX(attackSfxName, false);
if (enemy != null) enemy.health.TakeDamage(entityData.attackDamage);
if (enemy != null)
{
enemy.health.TakeDamage(entityData.attackDamage);
string[] antDamage = {"EnemyDamage1", "EnemyDamage2", "EnemyDamage3"};
AudioManager.instance.PlaySFX(antDamage);
}
}
Debug.Log("Finished attacking");
this.targetObject = null;
Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/EnemyScripts/AcidMaggot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ protected IEnumerator Attack()
{
Debug.Log("Attacking ant");
nearestAnt.health.TakeDamage(entityData.attackDamage);
AudioManager.instance.PlaySFX("AcidSpit", false);
string[] antDamage = {"AntDamage1", "AntDamage2", "AntDamage3"};
AudioManager.instance.PlaySFX(antDamage);
}
//delay for animation
yield return new WaitForSeconds(1f);
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/EnemyScripts/Beetle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ protected override IEnumerator AttackSequence(GameObject targetObject)
nearestAnt.health.TakeDamage(entityData.attackDamage);
anim.SetTrigger("Attack");
AudioManager.instance.PlaySFX("Bite", false);
string[] antDamage = {"AntDamage1", "AntDamage2", "AntDamage3"};
AudioManager.instance.PlaySFX(antDamage);
//delay for animation
yield return new WaitForSeconds(1f);
}
Expand Down
2 changes: 2 additions & 0 deletions Assets/Scripts/EnemyScripts/Mantis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ protected override IEnumerator AttackSequence(GameObject targetObject)
nearestAnt.health.TakeDamage(entityData.attackDamage);
anim.SetTrigger("Attack");
AudioManager.instance.PlaySFX("Whoosh", false);
string[] antDamage = {"AntDamage1", "AntDamage2", "AntDamage3"};
AudioManager.instance.PlaySFX(antDamage);
//delay for animation
yield return new WaitForSeconds(1f);
}
Expand Down
16 changes: 16 additions & 0 deletions Assets/Scripts/ShopMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,53 +32,69 @@ public void Awake()

public void BuyWorker()
{
FindObjectOfType<AudioManager>().PlaySFX("Button");
if (CanAfford(workerAntData))
{
Instantiate(workerAnt, queenAnt.transform.position, Quaternion.Euler(0, 0, -90));
Buy(workerAntData);
Debug.Log("Buy Worker");
FindObjectOfType<AudioManager>().PlaySFX("Coin");
FindObjectOfType<AudioManager>().PlaySFX("SummonWorker");
}
}

public void BuyCarpenter()
{
FindObjectOfType<AudioManager>().PlaySFX("Button");
if(CanAfford(carpenterAntData))
{
Instantiate(carpenterAnt, queenAnt.transform.position, Quaternion.Euler(0, 0, -90));
Buy(carpenterAntData);
Debug.Log("Buy Carpenter");
FindObjectOfType<AudioManager>().PlaySFX("Coin");
FindObjectOfType<AudioManager>().PlaySFX("SummonCarpenter");
}

}

public void BuyWarrior()
{
FindObjectOfType<AudioManager>().PlaySFX("Button");
if (CanAfford(carpenterAntData))
{
Instantiate(warriorAnt, queenAnt.transform.position, Quaternion.Euler(0, 0, -90));
Buy(warriorAntData);
Debug.Log("Buy Warrior");
FindObjectOfType<AudioManager>().PlaySFX("Coin");
FindObjectOfType<AudioManager>().PlaySFX("SummonWarrior");
}
}

public void BuyBullet()
{
FindObjectOfType<AudioManager>().PlaySFX("Button");
if (CanAfford(bulletAntData))
{
Instantiate(bulletAnt, queenAnt.transform.position, Quaternion.Euler(0, 0, -90));
Buy(bulletAntData);
Debug.Log("Buy Bullet");
FindObjectOfType<AudioManager>().PlaySFX("Coin");
FindObjectOfType<AudioManager>().PlaySFX("SummonBullet");
}
}

public void BuySpike()
{
FindObjectOfType<AudioManager>().PlaySFX("Button");
Debug.Log("Buy Spike");
//FindObjectOfType<AudioManager>().PlaySFX("Coin");
}

public void BuyMine()
{
FindObjectOfType<AudioManager>().PlaySFX("Button");
Debug.Log("Buy Mine");
//FindObjectOfType<AudioManager>().PlaySFX("Coin");
}

public bool CanAfford(EntityData data)
Expand Down

0 comments on commit 7ae74dd

Please sign in to comment.