summaryrefslogtreecommitdiff
path: root/ContextSwitcher.cs
blob: 592c8094a74b985794797fff47cb22c2cb4958d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Collections.Generic;
using DeepSky.Haze;
using UnityEngine;

public class ContextSwitcher : MonoBehaviour
{
	public List<DS_HazeContextAsset> contexts = new List<DS_HazeContextAsset>();

	private DS_HazeView _view;

	private int _contextIndex;

	private void Start()
	{
		_view = GetComponent<DS_HazeView>();
	}

	private void Update()
	{
		if (contexts.Count > 0 && _view != null && Input.GetKeyUp(KeyCode.C))
		{
			_contextIndex++;
			if (_contextIndex == contexts.Count)
			{
				_contextIndex = 0;
			}
			_view.ContextAsset = contexts[_contextIndex];
			_view.OverrideContextAsset = true;
		}
	}
}