Warcorrespondents/Assets/Scripts/BlackHouseGunLight.cs
SAIPO 2fe9b0c020 任务
1.增加了序章回忆场景的胶片模拟划痕Shader
2.增加了第一关的下雨Shader
3.增加了第一关堡垒的枪光闪烁
4.修复了第一关机枪兵的音效与枪光的延迟的bug
5.增加了第二关的探照灯
6.修复了序章场景的对话错别字
❥❥(^_-)❤❤
2021-09-08 22:16:05 +08:00

55 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlackHouseGunLight : MonoBehaviour
{
private bool upLight = true;
public GameObject light1;
public GameObject light2;
public bool isFire = false;
public bool isInvoke = false;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (isFire && (!isInvoke))
{
InvokeRepeating("ChangeLight",0f,0.05f);
isInvoke = true;
}
if (!isFire && isInvoke)
{
CancelInvoke();
isInvoke = false;
light1.SetActive(false);
light2.SetActive(false);
}
}
void ChangeLight()
{
if (upLight)
{
light1.SetActive(upLight);
light2.SetActive(upLight);
upLight = false;
}
else
{
light2.SetActive(upLight);
light1.SetActive(upLight);
upLight = true;
}
}
}