You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
727 B
C#
34 lines
727 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SkyTimeline : MonoBehaviour
|
|
{
|
|
public Material SkyMaterial;
|
|
public AnimationCurve Curve1;
|
|
public float TimeScale1 = 20;
|
|
public string ShaderProperty1;
|
|
|
|
private float startValue;
|
|
|
|
private float currentTime;
|
|
|
|
void OnEnable()
|
|
{
|
|
currentTime = 0;
|
|
startValue = SkyMaterial.GetFloat(ShaderProperty1);
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
SkyMaterial.SetFloat(ShaderProperty1, startValue);
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
currentTime += Time.deltaTime;
|
|
var param1 = Curve1.Evaluate(currentTime / TimeScale1);
|
|
SkyMaterial.SetFloat(ShaderProperty1, param1);
|
|
}
|
|
}
|