1.怎么做出一个照明火炬
通过调整Emission,Shape,Size overLifetime来进行粒子系统的调整
火焰闪烁的代码:
public class FlameAnimations : MonoBehaviour
{
public int LightMode; //所有的动画效果
public GameObject FlameLight;
void Update()
{
if (LightMode == 0) //如果lightmode=0就可以运行任一一个火焰动画
{
StartCoroutine(AnimateLight()); //开始一个新的协同程序
}
}
IEnumerator AnimateLight() //需要严格向下执行时用IEnumerator
{
LightMode = Random.Range(1, 4);
if (LightMode == 1)
{
FlameLight.GetComponent<Animation>().Play("TorchAnim1");
}
if (LightMode == 2)
{
FlameLight.GetComponent<Animation>().Play("TorchAnim2");
}
if (LightMode == 3)
{
FlameLight.GetComponent<Animation>().Play("TorchAnim3");
}
yield return new WaitForSeconds(0.99f);
LightMode = 0;
}
}