religion/Assets/Shader/阴间/Underworld.cs

40 lines
693 B
C#
Raw Normal View History

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Underworld : MonoBehaviour
{
public Material dead;
public float speed;
public static bool isDead = false;
private float step = 0;
void Start()
{
dead.SetFloat("_Step",0);
}
void Update()
{
if (isDead == true)
{
StartCoroutine(startDead());
isDead = false;
}
}
public IEnumerator startDead()
{
while (step<1)
{
step += 0.02f;
dead.SetFloat("_Step",step);
yield return new WaitForSeconds(speed);
}
}
}