Fixed some bugs. Added sfx random. Modified Jump sfx playback. Set low volume for enemy
This commit is contained in:
parent
7913e3bb14
commit
dd7f32ba38
File diff suppressed because it is too large
Load Diff
@ -4,37 +4,48 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class AudioController : MonoBehaviour
|
public class AudioController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public AudioClip jump_SFX, capture_SFX, hit_SFX;
|
public List<AudioClip> jump_SFXs;
|
||||||
|
public List<AudioClip> capture_SFXs;
|
||||||
|
public AudioClip hit_SFX;
|
||||||
|
|
||||||
[SerializeField] private AudioSource ac;/* capSrc, hitSrc, collectSrc;*/
|
[SerializeField] private AudioSource ac;/* capSrc, hitSrc, collectSrc;*/
|
||||||
|
|
||||||
|
private float _startVolume;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_startVolume = ac.volume;
|
||||||
|
}
|
||||||
|
|
||||||
public void PlayJumpSound()
|
public void PlayJumpSound()
|
||||||
{
|
{
|
||||||
ac.volume = 1f;
|
ac.volume = _startVolume;
|
||||||
ac.PlayOneShot(jump_SFX);
|
int sfxIndex = Random.Range(0, jump_SFXs.Count);
|
||||||
|
ac.PlayOneShot(jump_SFXs[sfxIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayCapSound()
|
public void PlayCapSound()
|
||||||
{
|
{
|
||||||
ac.volume = 1f;
|
ac.volume = _startVolume;
|
||||||
ac.PlayOneShot(capture_SFX);
|
int sfxIndex = Random.Range(0, capture_SFXs.Count);
|
||||||
|
ac.PlayOneShot(capture_SFXs[sfxIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayHitSound()
|
public void PlayHitSound()
|
||||||
{
|
{
|
||||||
ac.volume = 0.5f;
|
ac.volume = 0.5f*_startVolume;
|
||||||
ac.PlayOneShot(hit_SFX);
|
ac.PlayOneShot(hit_SFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayCollectSound( AudioClip clip)
|
public void PlayCollectSound( AudioClip clip)
|
||||||
{
|
{
|
||||||
ac.volume = 1f;
|
ac.volume = _startVolume;
|
||||||
ac.PlayOneShot(clip);
|
ac.PlayOneShot(clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlaySound(AudioClip clip)
|
public void PlaySound(AudioClip clip)
|
||||||
{
|
{
|
||||||
ac.volume = 0.6f;
|
ac.volume = 0.6f*_startVolume;
|
||||||
ac.PlayOneShot(clip);
|
ac.PlayOneShot(clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
Assets/FootStepsSound.cs
Normal file
17
Assets/FootStepsSound.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class FootStepsSound : MonoBehaviour
|
||||||
|
{
|
||||||
|
private AudioController _controller;
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_controller = transform.parent.GetComponent<AudioController>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Step()
|
||||||
|
{
|
||||||
|
_controller.PlayJumpSound();
|
||||||
|
}
|
||||||
|
}
|
11
Assets/FootStepsSound.cs.meta
Normal file
11
Assets/FootStepsSound.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f004223755ee0f445aad5f3731cda741
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@ -199,6 +199,8 @@ public class DeathChecker : MonoBehaviour
|
|||||||
//////////////////////////PLAYER DEATH//////////////
|
//////////////////////////PLAYER DEATH//////////////
|
||||||
if (player.ownerIndex == TileOwner.Ariost)
|
if (player.ownerIndex == TileOwner.Ariost)
|
||||||
{
|
{
|
||||||
|
TileManagment.OnAnyTileCaptured = null;
|
||||||
|
TileManagment.OnInitialized = null;
|
||||||
StartCoroutine(GoToMenuAfter(3f));
|
StartCoroutine(GoToMenuAfter(3f));
|
||||||
}
|
}
|
||||||
//////////////////////////PLAYER DEATH//////////////
|
//////////////////////////PLAYER DEATH//////////////
|
||||||
|
@ -21,6 +21,10 @@ public class GameManager : MonoBehaviour
|
|||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
activePlayers.Clear();
|
||||||
|
tempDeadPlayers.Clear();
|
||||||
|
deadPlayers.Clear();
|
||||||
|
players.Clear();
|
||||||
DeathChecker.OnPlayerDeath += KillPlayer;
|
DeathChecker.OnPlayerDeath += KillPlayer;
|
||||||
DeathChecker.OnPlayerRes += ResPlayer;
|
DeathChecker.OnPlayerRes += ResPlayer;
|
||||||
DeathChecker.OnPlayerDeathPermanent += DestroyPermanent;
|
DeathChecker.OnPlayerDeathPermanent += DestroyPermanent;
|
||||||
|
@ -28,12 +28,15 @@ public class TileManagment : MonoBehaviour
|
|||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
//OnInitialized = null;
|
||||||
|
//OnAnyTileCaptured = null;
|
||||||
InitTileManager();
|
InitTileManager();
|
||||||
Debug.Log("tile offset is " + tileOffset + " points");
|
Debug.Log("tile offset is " + tileOffset + " points");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitTileManager()
|
private void InitTileManager()
|
||||||
{
|
{
|
||||||
|
levelTiles.Clear();
|
||||||
SetStaticTileMaterials();
|
SetStaticTileMaterials();
|
||||||
InitCharacterTiles();
|
InitCharacterTiles();
|
||||||
for (int i = 0; i < _tileParent.childCount; i++)
|
for (int i = 0; i < _tileParent.childCount; i++)
|
||||||
@ -72,6 +75,10 @@ public class TileManagment : MonoBehaviour
|
|||||||
}
|
}
|
||||||
private void InitCharacterTiles()
|
private void InitCharacterTiles()
|
||||||
{
|
{
|
||||||
|
if (charTiles.Count > 0)
|
||||||
|
{
|
||||||
|
charTiles.Clear();
|
||||||
|
}
|
||||||
for (int i = 0; i < tileMaterialsStatic.Count; i++)
|
for (int i = 0; i < tileMaterialsStatic.Count; i++)
|
||||||
{
|
{
|
||||||
List<TileInfo> charTileList = new List<TileInfo>();
|
List<TileInfo> charTileList = new List<TileInfo>();
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user