2023-04-09 14:35:38 +00:00
|
|
|
using System;
|
|
|
|
using TMPro;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class StartUIManager : MonoBehaviour
|
|
|
|
{
|
2023-06-30 09:30:12 +00:00
|
|
|
public int waitTimeLimit = 45;
|
|
|
|
public GameObject sceneLoaderObj;
|
|
|
|
public GameObject startSceneDataObj;
|
|
|
|
public TextMeshProUGUI messageTextObj;
|
|
|
|
public TextMeshProUGUI waitTimeTextObj;
|
2023-04-09 14:35:38 +00:00
|
|
|
private SceneLoader sceneLoader;
|
|
|
|
private StartSeneData startSceneData;
|
|
|
|
private float startTime;
|
|
|
|
private float nowTime;
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
2023-06-30 09:30:12 +00:00
|
|
|
sceneLoader = sceneLoaderObj.GetComponent<SceneLoader>();
|
|
|
|
startSceneData = startSceneDataObj.GetComponent<StartSeneData>();
|
|
|
|
messageTextObj.text = "";
|
2023-04-09 14:35:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
// update time limit left;
|
2023-06-30 09:30:12 +00:00
|
|
|
float leftTime = waitTimeLimit - Time.realtimeSinceStartup;
|
|
|
|
waitTimeTextObj.text = ((int)Math.Round(leftTime)).ToString();
|
2023-04-09 14:35:38 +00:00
|
|
|
if (leftTime <= 1)
|
|
|
|
{
|
|
|
|
// if time limit is over, load Train Scene
|
2023-06-30 09:30:12 +00:00
|
|
|
sceneLoader.LoadGameScene(SceneLoader.SceneType.Train);
|
2023-04-09 14:35:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// while StartButton-Play Pressed
|
|
|
|
public void OnPlayButtonPressed()
|
|
|
|
{
|
2023-07-28 10:44:02 +00:00
|
|
|
startSceneData.gameMode = 1;
|
2023-06-30 09:30:12 +00:00
|
|
|
sceneLoader.LoadGameScene(SceneLoader.SceneType.Play);
|
|
|
|
messageTextObj.text = "Loading Play Scene...";
|
2023-04-09 14:35:38 +00:00
|
|
|
}
|
2023-07-08 14:22:31 +00:00
|
|
|
|
|
|
|
public void OnAttackTrainButtonPressed()
|
|
|
|
{
|
|
|
|
// while Train-Attack-Button Pressed
|
|
|
|
startSceneData.attackProb = 1f;
|
|
|
|
LoadTrainScene();
|
|
|
|
}
|
|
|
|
public void OnGotoTrainButtonPressed()
|
|
|
|
{
|
|
|
|
// while Train-Goto-Button Pressed
|
|
|
|
startSceneData.gotoProb = 1f;
|
|
|
|
LoadTrainScene();
|
|
|
|
}
|
|
|
|
public void OnFreeTrainButtonPressed()
|
|
|
|
{
|
|
|
|
// while Train-Free-Button Pressed
|
|
|
|
LoadTrainScene();
|
|
|
|
}
|
|
|
|
public void OnMixTrainButtonPressed()
|
|
|
|
{
|
|
|
|
// while Train-Mix-Button Pressed
|
|
|
|
startSceneData.attackProb = 0.333f;
|
|
|
|
startSceneData.gotoProb = 0.333f;
|
|
|
|
LoadTrainScene();
|
|
|
|
}
|
|
|
|
private void LoadTrainScene()
|
|
|
|
{
|
|
|
|
// load Train Scene
|
|
|
|
sceneLoader.LoadGameScene(SceneLoader.SceneType.Train);
|
|
|
|
messageTextObj.text = "Loading Train Scene...";
|
|
|
|
}
|
2023-04-09 14:35:38 +00:00
|
|
|
|
2023-07-08 14:22:31 +00:00
|
|
|
|
|
|
|
|
2023-04-09 14:35:38 +00:00
|
|
|
}
|