thewar_client/Client/Assets/1_Script/TitleCtrl.cs

52 lines
1.3 KiB
C#

using UnityEngine;
using UnityEngine.UI;
public class TitleCtrl : MonoBehaviour
{
[SerializeField] Image img;
bool is_a255 = false;
float dtime = 0;
private void Awake()
{
img.color = new Color(1, 1, 1, 0);
}
private void Start()
{
SoundManager.Instance.StartSound(SoundManager.eEftSuond.TitleSound);
}
void Update()
{
if (is_a255)
{
dtime += Time.deltaTime;
if (dtime >= 3.0f)
{
img.color -= new Color(0, 0, 0, 0.7f) * Time.deltaTime;
if (img.color.a <= -0.3f)
{
GameManager.Instance.NextScene(GameManager.eScene.Main);
}
}
}
else
{
img.color += new Color(0, 0, 0, 1.0f) * Time.deltaTime;
if (img.color.a >= 1)
{
is_a255 = true;
}
}
if (Input.GetKeyDown(KeyCode.Escape))
{
if (SelectWindows.Instance.Active)
{
SelectWindows.Instance.OnPressCancel();
}
else
{
//SelectWindows.Instance.SetUI("게임을 종료하시겠습니까?", () => { GameManager.Instance.ExitWindows(); });
}
}
}
}