You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.5 KiB
65 lines
1.5 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace UltraCombos.Frozen
|
|
{
|
|
public class SceneController : MonoBehaviour
|
|
{
|
|
[Range(0, 1)]
|
|
public float rate = 0.0f;
|
|
|
|
[SerializeField]
|
|
UniformBlendedStructuredBuffer uniform;
|
|
|
|
[SerializeField]
|
|
Material spaceMaterial;
|
|
|
|
[SerializeField, Range(0.0f, 0.1f)]
|
|
float snowSize = 0.01f;
|
|
[SerializeField]
|
|
Material snowMaterial;
|
|
|
|
[SerializeField]
|
|
BlendedCosineGradient cosineGradient;
|
|
|
|
[SerializeField]
|
|
List<CharacterBehaviour> dayCharacters = new List<CharacterBehaviour>();
|
|
|
|
[SerializeField]
|
|
List<CharacterBehaviour> nightCharacters = new List<CharacterBehaviour>();
|
|
|
|
[SerializeField]
|
|
bool debug = false;
|
|
|
|
private void Start()
|
|
{
|
|
//debug = false;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (debug)
|
|
{
|
|
rate = Mathf.Sin(Time.time * 0.2f) * 0.5f + 0.5f;
|
|
}
|
|
|
|
uniform.rate = rate;
|
|
spaceMaterial.SetFloat("_Rate", rate);
|
|
snowMaterial.SetFloat("_Size", Mathf.Lerp(0.0f, snowSize, rate));
|
|
cosineGradient.rate = rate;
|
|
|
|
foreach (var chr in dayCharacters)
|
|
{
|
|
chr.gameObject.SetActive(rate < 0.5);
|
|
}
|
|
|
|
foreach (var chr in nightCharacters)
|
|
{
|
|
chr.gameObject.SetActive(rate > 0.5);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|