-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoadLevel.cs
More file actions
39 lines (32 loc) · 826 Bytes
/
LoadLevel.cs
File metadata and controls
39 lines (32 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class LoadLevel : MonoBehaviour {
public Image fadescreen;
public bool fading = false;
public float alpha;
void Start()
{
alpha = 0;
}
private void Update()
{
if (fading)
{
fadescreen.color = new Color(fadescreen.color.r, fadescreen.color.g, fadescreen.color.b, alpha);
alpha += Time.deltaTime * 1.5f;
}
if (alpha >= 1)
{
fading = false;
SceneManager.LoadScene("GameScene");
}
}
public void GenLevel()
{
fading = true;
fadescreen.gameObject.SetActive(true);
}
}