Add skybox, fix world map, temporarily break level load to demo stuff
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Scampz.GameJam
|
||||
{
|
||||
void Start()
|
||||
{
|
||||
GameManager.Instance.LoadScene(SceneNames.ThirdPreRenderedScene, LoadSceneMode.Additive);
|
||||
GameManager.Instance.LoadScene(SceneManager.GetSceneByName(SceneNames.TempleC), LoadSceneMode.Additive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using Scampz.GameJam.Assets.Scripts;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
@@ -6,14 +6,34 @@ namespace Scampz.GameJam
|
||||
public class Footsteps : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private AudioClip[] clips;
|
||||
private AudioClip grassStep;
|
||||
[SerializeField]
|
||||
private AudioClip templeStep;
|
||||
[SerializeField]
|
||||
private AudioClip sandStep;
|
||||
[SerializeField]
|
||||
private AudioSource audioSource;
|
||||
|
||||
private void Step()
|
||||
{
|
||||
var clip = clips.First();
|
||||
var clip = GetAudioClip();
|
||||
audioSource.PlayOneShot(clip);
|
||||
}
|
||||
|
||||
private AudioClip GetAudioClip()
|
||||
{
|
||||
var terrainType = TerrainTypeFinder.Find();
|
||||
switch(terrainType)
|
||||
{
|
||||
case TerrainType.Grass:
|
||||
return grassStep;
|
||||
case TerrainType.Temple:
|
||||
return templeStep;
|
||||
case TerrainType.Sand:
|
||||
return sandStep;
|
||||
}
|
||||
|
||||
return templeStep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,31 +17,21 @@ namespace Scampz.GameJam
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadScene(int levelIndex, LoadSceneMode loadSceneMode)
|
||||
public void LoadScene(Scene scene, LoadSceneMode loadSceneMode)
|
||||
{
|
||||
StartCoroutine(LoadSceneAsync(levelIndex, loadSceneMode));
|
||||
StartCoroutine(LoadSceneAsync(scene, loadSceneMode));
|
||||
}
|
||||
|
||||
public void LoadScene(string sceneName, LoadSceneMode loadSceneMode)
|
||||
public void UnloadScene(Scene scene)
|
||||
{
|
||||
StartCoroutine(LoadSceneAsync(sceneName, loadSceneMode));
|
||||
StartCoroutine(UnloadSceneAsync(scene));
|
||||
}
|
||||
|
||||
public void UnloadScene(int levelIndex)
|
||||
{
|
||||
StartCoroutine(UnloadSceneAsync(levelIndex));
|
||||
}
|
||||
|
||||
public void UnloadScene(string sceneName)
|
||||
{
|
||||
StartCoroutine(UnloadSceneAsync(sceneName));
|
||||
}
|
||||
|
||||
IEnumerator LoadSceneAsync(int levelIndex, LoadSceneMode loadSceneMode)
|
||||
private IEnumerator LoadSceneAsync(Scene scene, LoadSceneMode loadSceneMode)
|
||||
{
|
||||
yield return null;
|
||||
|
||||
var loadSceneOperation = SceneManager.LoadSceneAsync(levelIndex, loadSceneMode);
|
||||
var loadSceneOperation = SceneManager.LoadSceneAsync(scene.name, loadSceneMode);
|
||||
loadSceneOperation.allowSceneActivation = false;
|
||||
while (!loadSceneOperation.isDone)
|
||||
{
|
||||
@@ -53,34 +43,11 @@ namespace Scampz.GameJam
|
||||
yield return loadSceneOperation;
|
||||
}
|
||||
|
||||
private IEnumerator UnloadSceneAsync(int levelIndex)
|
||||
private IEnumerator UnloadSceneAsync(Scene scene)
|
||||
{
|
||||
yield return null;
|
||||
|
||||
SceneManager.UnloadSceneAsync(levelIndex);
|
||||
if (SceneManager.GetSceneByName(scene.name).IsValid())
|
||||
SceneManager.UnloadSceneAsync(scene);
|
||||
}
|
||||
|
||||
private IEnumerator LoadSceneAsync(string sceneName, LoadSceneMode loadSceneMode)
|
||||
{
|
||||
yield return null;
|
||||
var loadSceneOperation = SceneManager.LoadSceneAsync(sceneName, loadSceneMode);
|
||||
loadSceneOperation.allowSceneActivation = false;
|
||||
while (!loadSceneOperation.isDone)
|
||||
{
|
||||
if (loadSceneOperation.progress >= 0.9f)
|
||||
break;
|
||||
}
|
||||
|
||||
loadSceneOperation.allowSceneActivation = true;
|
||||
yield return loadSceneOperation;
|
||||
}
|
||||
|
||||
private IEnumerator UnloadSceneAsync(string sceneName)
|
||||
{
|
||||
yield return null;
|
||||
|
||||
SceneManager.UnloadSceneAsync(sceneName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Scampz.GameJam.Assets.Scripts;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
@@ -7,7 +8,8 @@ namespace Scampz.GameJam
|
||||
{
|
||||
private bool loaded = false;
|
||||
public Transform spawnPoint;
|
||||
public int sceneIndex;
|
||||
[SerializeField]
|
||||
public int scene;
|
||||
|
||||
void OnTriggerEnter(Collider collider)
|
||||
{
|
||||
@@ -17,7 +19,7 @@ namespace Scampz.GameJam
|
||||
var player = GameObject.FindWithTag("Player");
|
||||
var cc = player.GetComponent<CharacterController>();
|
||||
cc.enabled = false;
|
||||
GameManager.Instance.LoadScene(sceneIndex, LoadSceneMode.Additive);
|
||||
GameManager.Instance.LoadScene(SceneManager.GetSceneByName(SceneNames.TempleA), LoadSceneMode.Additive);
|
||||
player.transform.position = spawnPoint.position;
|
||||
player.transform.rotation = spawnPoint.rotation;
|
||||
cc.enabled = true;
|
||||
|
||||
15
Assets/Scripts/RotateCamera.cs
Normal file
15
Assets/Scripts/RotateCamera.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class RotateCamera : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private float speed;
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(0, speed * Time.deltaTime, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,21 +2,13 @@
|
||||
{
|
||||
public static class SceneNames
|
||||
{
|
||||
public static string FirstPreRenderedScene => "Pre-Render0";
|
||||
public static string TempleA => "TempleA";
|
||||
|
||||
public static string SecondPreRenderedScene => "Pre-Render1";
|
||||
public static string TempleB => "TempleB";
|
||||
|
||||
public static string ThirdPreRenderedScene => "Pre-Render2";
|
||||
public static string TempleC => "TempleC";
|
||||
|
||||
public static string FourthPreRenderedScene => "Pre-Render3";
|
||||
|
||||
public static string FifthPreRenderedScene => "Pre-Render4";
|
||||
|
||||
public static string SixthPreRenderedScene => "Pre-Render5";
|
||||
|
||||
public static string SeventhPreRenderedScene => "Pre-Render6";
|
||||
|
||||
public static string EightPreRenderedScene => "Pre-Render8";
|
||||
public static string TempleD => "TempleD";
|
||||
|
||||
public static string TitleScreenScene => "TitleScreen";
|
||||
|
||||
|
||||
9
Assets/Scripts/TerrainType.cs
Normal file
9
Assets/Scripts/TerrainType.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
public enum TerrainType
|
||||
{
|
||||
Grass,
|
||||
Temple,
|
||||
Sand
|
||||
}
|
||||
}
|
||||
28
Assets/Scripts/TerrainTypeFinder.cs
Normal file
28
Assets/Scripts/TerrainTypeFinder.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
public class TerrainTypeFinder : MonoBehaviour
|
||||
{
|
||||
public static TerrainType Find()
|
||||
{
|
||||
var sceneCount = SceneManager.sceneCount;
|
||||
var scenes = new List<Scene>();
|
||||
|
||||
for (var i = 0; i < sceneCount; ++i)
|
||||
scenes.Add(SceneManager.GetSceneAt(i));
|
||||
|
||||
if (scenes.Any(x => x.name.Contains("Temple")))
|
||||
return TerrainType.Temple;
|
||||
if (scenes.Any(x => x.name.Contains("Grass")))
|
||||
return TerrainType.Grass;
|
||||
if (scenes.Any(x => x.name.Contains("Sand")))
|
||||
return TerrainType.Sand;
|
||||
|
||||
return TerrainType.Temple;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace Scampz.GameJam
|
||||
{
|
||||
if (Input.GetButtonDown(InputOptions.Submit))
|
||||
{
|
||||
GameManager.Instance.LoadScene(SceneNames.BaseScene, LoadSceneMode.Single);
|
||||
GameManager.Instance.LoadScene(SceneManager.GetSceneByName(SceneNames.BaseScene), LoadSceneMode.Single);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Scampz.GameJam
|
||||
{
|
||||
public class UnloadScene : MonoBehaviour
|
||||
{
|
||||
public int scene;
|
||||
[SerializeField]
|
||||
public Scene scene;
|
||||
private bool unloaded = false;
|
||||
|
||||
void OnTriggerEnter(Collider collider)
|
||||
@@ -12,7 +14,6 @@ namespace Scampz.GameJam
|
||||
if (!unloaded)
|
||||
{
|
||||
unloaded = true;
|
||||
|
||||
GameManager.Instance.UnloadScene(scene);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user