Add sound effects and audio clips for weapons and actions; implement shot and damage sounds

This commit is contained in:
2025-07-13 13:33:29 +02:00
parent 7519d67950
commit 0ca0aeae86
3557 changed files with 8596 additions and 1314011 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections;
using Data;
using Sirenix.Serialization;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Systems
{
@@ -16,6 +17,8 @@ namespace Systems
[OdinSerialize, SerializeField] private int coins = 0;
[OdinSerialize, SerializeField] private float roundTime = 60f;
[OdinSerialize, SerializeField] private int maxRounds = 20;
[OdinSerialize, SerializeField] private Scene winScene;
[OdinSerialize, SerializeField] private Transform arenaCenter;
[OdinSerialize, SerializeField] private Character player;
@@ -35,14 +38,9 @@ namespace Systems
private void Awake()
{
if (Instance == null)
{
Instance = this;
// DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
private void Start()
@@ -57,6 +55,7 @@ namespace Systems
for (currentRound = 1; currentRound <= maxRounds; currentRound++)
{
player.transform.position = new Vector3(arenaCenter.position.x, arenaCenter.position.y, player.transform.position.z);
OnRoundStart?.Invoke(currentRound);
timer = roundTime;
@@ -71,6 +70,8 @@ namespace Systems
OnStoreOpen?.Invoke();
yield return new WaitUntil(() => StoreIsClosed);
}
SceneManager.LoadScene(winScene.name);
}
public void AddCoins(int amount)

View File

@@ -11,6 +11,7 @@ namespace Systems
[Self, SerializeField] private Character character;
[SerializeField] private float initialHealth = 100f;
[SerializeField] private AudioClip damageSound;
public GameObject LastAttacker => lastAttacker;
@@ -24,8 +25,15 @@ namespace Systems
public void TakeDamage(float damage, GameObject attacker = null)
{
lastAttacker = attacker;
var effectiveDamage = Math.Max(damage - character.attributes.Armor, 1);
character.attributes.ModifyHealth(-effectiveDamage);
if (damageSound)
{
AudioSource.PlayClipAtPoint(damageSound, transform.position);
}
OnTakeDamage?.Invoke();
}
}