在此项目中,您能够访问使用 Visual Effect Graph 制作的示例场景和效果。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

60 行
1.2 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
using UnityEngine.VFX;
public class MeteoriteControl : MonoBehaviour
{
public float initDelay = 3;
public float loopDelay = 10;
public PlayableDirector Director;
float m_Time;
bool m_isMenuOpen;
// Start is called before the first frame update
void Start()
{
m_Time = initDelay;
}
private void OnEnable()
{
if(SampleLoader.instance != null)
SampleLoader.instance.onMenuToggle += Instance_onMenuToggle;
}
private void OnDisable()
{
if (SampleLoader.instance != null)
SampleLoader.instance.onMenuToggle -= Instance_onMenuToggle;
}
private void Instance_onMenuToggle(bool isOpen)
{
m_isMenuOpen = isOpen;
}
// Update is called once per frame
void Update()
{
m_Time = m_Time - Time.deltaTime;
if (Input.anyKey && !Input.GetMouseButton(1) && Director.time==0 && !m_isMenuOpen )
{
m_Time = -1;
}
if (m_Time<0)
{
m_Time = loopDelay;
Director?.Play();
}
}
}