VR模拟枪支打靶,消灭鬼怪,换弹以及上弦等等硬核枪支操作。 使用HTCVive设备,开启SteamVR进行游玩。
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.
 
 
 
 
 

38 lines
985 B

using UnityEngine;
using System.Collections;
public class ME_LightCurves : MonoBehaviour
{
public AnimationCurve LightCurve = AnimationCurve.EaseInOut(0, 0, 1, 1);
public float GraphTimeMultiplier = 1, GraphIntensityMultiplier = 1;
public bool IsLoop;
private bool canUpdate;
private float startTime;
private Light lightSource;
private void Awake()
{
lightSource = GetComponent<Light>();
lightSource.intensity = LightCurve.Evaluate(0);
}
private void OnEnable()
{
startTime = Time.time;
canUpdate = true;
}
private void Update()
{
var time = Time.time - startTime;
if (canUpdate) {
var eval = LightCurve.Evaluate(time / GraphTimeMultiplier) * GraphIntensityMultiplier;
lightSource.intensity = eval;
}
if (time >= GraphTimeMultiplier) {
if (IsLoop) startTime = Time.time;
else canUpdate = false;
}
}
}