43 lines
989 B
C#
43 lines
989 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Game
|
|
{
|
|
public class Game : MonoBehaviour
|
|
{
|
|
private UIManager _uiManager;
|
|
private ResourceManager _resourceManager;
|
|
[SerializeField] private LoadType _loadType = LoadType.Editor;
|
|
[SerializeField] private float time;
|
|
|
|
private void Awake()
|
|
{
|
|
DontDestroyOnLoad(this.gameObject);
|
|
|
|
_uiManager = new UIManager();
|
|
_resourceManager = new ResourceManager();
|
|
|
|
_resourceManager.Init();
|
|
_uiManager.Init();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
StartCoroutine(_resourceManager.InitLoadMode(_loadType));
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
time += Time.deltaTime;
|
|
|
|
_resourceManager.Update(time);
|
|
_uiManager.Update(time);
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
_resourceManager.Dispose();
|
|
_uiManager.Dispose();
|
|
}
|
|
}
|
|
} |