Start on attempt to consolidate multiple scenes into one

This commit is contained in:
2022-08-19 14:36:04 -07:00
parent 4e39c75095
commit 82fe821806
11 changed files with 7874 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ using UnityEngine.SceneManagement;
namespace Scampz.GameJam.Assets.Scripts
{
[RequireComponent(typeof(AudioSource))]
public class BGMManager : MonoBehaviour
{

View File

@@ -3,25 +3,29 @@ using UnityEngine;
namespace Scampz.GameJam
{
[RequireComponent(typeof(AudioSource))]
public class Footsteps : MonoBehaviour
{
[SerializeField]
private AudioClip grassStep;
private SFXClip grassStep;
[SerializeField]
private AudioClip templeStep;
private SFXClip templeStep;
[SerializeField]
private AudioClip sandStep;
private SFXClip sandStep;
[SerializeField]
private AudioSource audioSource;
public void Step()
{
Debug.Log("Step SFX");
var clip = GetAudioClip();
audioSource.PlayOneShot(clip);
var soundEffect = GetAudioClip();
audioSource.pitch = Random.Range(soundEffect.pitchMin, soundEffect.pitchMax);
audioSource.volume = Random.Range(soundEffect.volumeMin, soundEffect.volumeMax);
audioSource.clip = soundEffect.audioClip;
audioSource.PlayOneShot(soundEffect.audioClip);
}
private AudioClip GetAudioClip()
private SFXClip GetAudioClip()
{
var terrainType = TerrainTypeFinder.Find();
switch (terrainType)
@@ -37,4 +41,14 @@ namespace Scampz.GameJam
return templeStep;
}
}
[System.Serializable]
public struct SFXClip
{
public AudioClip audioClip;
public float pitchMin;
public float pitchMax;
public float volumeMin;
public float volumeMax;
}
}

View File

@@ -39,7 +39,7 @@ namespace Scampz.GameJam.Assets.Scripts.Audio
=> _soundEffects.SoundEffects.Where(x => x.name.Equals(desiredSoundEffect)).Single();
}
public class SoundEffect
public class SoundEffectName
{
public static string ComputerTalk => "computer talk ed";

View File

@@ -65,7 +65,7 @@ namespace Scampz.GameJam
return;
}
SFXManager.Instance.PlaySoundEffect(SoundEffect.Narration);
SFXManager.Instance.PlaySoundEffect(SoundEffectName.Narration);
var sentence = sentences.Dequeue();
StopAllCoroutines();
@@ -86,7 +86,7 @@ namespace Scampz.GameJam
yield return new WaitForSecondsRealtime(1f);
SFXManager.Instance.StopSoundEffect();
yield return new WaitForKeyDown(InputOptions.Submit);
SFXManager.Instance.PlaySoundEffect(SoundEffect.Ok);
SFXManager.Instance.PlaySoundEffect(SoundEffectName.Ok);
yield return new WaitForSeconds(0.5f);
DisplayNextSentence();
}

View File

@@ -26,12 +26,14 @@ public class PlayerSpawnController : MonoBehaviour
{
_player = GameObject.FindGameObjectWithTag("Player");
_player.transform.position = _spawnLocation.transform.position;
_player.transform.rotation = _spawnLocation.transform.rotation;
}
else
{
_player = Instantiate(_playerPrefab);
_player.transform.position = _spawnLocation.transform.position;
_player.transform.rotation = _spawnLocation.transform.rotation;
DontDestroyOnLoad(_player);
}
}

View File

@@ -8,13 +8,11 @@ namespace Scampz.GameJam.Assets.Scripts
private CharacterController _controller;
public float Speed = 10f;
public float RotateSpeed = 720.0f;
private Animator _animator;
private PlayerState _playerState;
private void Start()
{
_controller = GetComponent<CharacterController>();
_animator = GetComponent<Animator>();
_playerState = GetComponent<PlayerState>();
}