123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- using DG.Tweening;
- /// <summary>
- /// This component is responsible for fading in the main game scene, after loading has completed.
- /// </summary>
- public class FadeInManager : MonoBehaviour
- {
- public static FadeInManager Instance;
- public GameObject uiRoot;
- public GameObject backgroundManager;
- public GameObject[] objectsToEnable;
- public Image sceneFaderRenderer;
- public bool runFromMainScene;
- void Awake()
- {
- OnSkinApplied();
- uiRoot.SetActive(true);
- backgroundManager.SetActive(true);
- foreach (GameObject go in objectsToEnable)
- {
- go.SetActive(true);
- }
-
- Instance = this;
- }
- void OnSkinApplied()
- {
- sceneFaderRenderer.DOFade(0f, 0.5f);
- OniTweenFadeInComplete();
- }
- void OniTweenFadeInComplete()
- {
- Destroy(gameObject);
- Destroy(sceneFaderRenderer.gameObject);
- }
- }
|