53 lines
796 B
C#
53 lines
796 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace UltimateWater.Samples
|
|
{
|
|
public class Walkthrough : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private List<string> _Scenes;
|
|
|
|
private int _Current;
|
|
|
|
public void Previous()
|
|
{
|
|
Unload(_Current);
|
|
_Current--;
|
|
if (_Current < 0)
|
|
{
|
|
_Current = _Scenes.Count - 1;
|
|
}
|
|
Load(_Current);
|
|
}
|
|
|
|
public void Next()
|
|
{
|
|
Unload(_Current);
|
|
_Current++;
|
|
if (_Current >= _Scenes.Count)
|
|
{
|
|
_Current = 0;
|
|
}
|
|
Load(_Current);
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
_Current = 0;
|
|
Load(_Current);
|
|
}
|
|
|
|
private void Load(int i)
|
|
{
|
|
SceneManager.LoadScene(_Scenes[i], LoadSceneMode.Additive);
|
|
}
|
|
|
|
private void Unload(int i)
|
|
{
|
|
SceneManager.UnloadScene(_Scenes[i]);
|
|
}
|
|
}
|
|
}
|