41 lines
864 B
C#
41 lines
864 B
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
public class ScreenRed : MonoBehaviour
|
||
{
|
||
public static ScreenRed instance;
|
||
|
||
private Image red;
|
||
public Color redColor;
|
||
private Color defaultColor;
|
||
|
||
// Start is called before the first frame update
|
||
void Start()
|
||
{
|
||
instance = this;
|
||
red = GameObject.Find("Canvas/ScreenRed").GetComponent<Image>();
|
||
defaultColor = red.color;
|
||
}
|
||
|
||
// Update is called once per frame
|
||
void Update()
|
||
{
|
||
|
||
}
|
||
|
||
public async void ShowRed()
|
||
{
|
||
await ScreenIsRedingAsync();
|
||
}
|
||
|
||
private async Task ScreenIsRedingAsync()
|
||
{
|
||
red.color = Color.Lerp(defaultColor, redColor, 0.5f);
|
||
await Task.Delay(300); // µÈ´ý300ºÁÃë
|
||
red.color = defaultColor;
|
||
}
|
||
}
|