From 4c192cebf7af6c271b8a8a9b10616c85ab2856dd Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 23 Aug 2020 18:00:57 -0400 Subject: Upgraded project; Main menu --- Assets/Scripts/LoadScene.cs | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Assets/Scripts/LoadScene.cs (limited to 'Assets/Scripts/LoadScene.cs') diff --git a/Assets/Scripts/LoadScene.cs b/Assets/Scripts/LoadScene.cs new file mode 100644 index 0000000..3fbb91e --- /dev/null +++ b/Assets/Scripts/LoadScene.cs @@ -0,0 +1,47 @@ +/******************************************************************************* +* +* Unicity (Project SimLife): A Sims clone written in Unity C# +* Copyright (C) 2019 Unicity Development Team +* +* This software is protected by the copyright and licensing rights held +* by the Unicity Development Team. (2019) +* +*********************************************************************************/ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; + +public class LoadScene : MonoBehaviour { + bool doMenuRotate; + int _SceneIndex; + GameObject MainPanel; + + public void MainMenuPlayButton(int SceneIndex) { + doMenuRotate = true; + _SceneIndex = SceneIndex; + } + + public void SceneLoader(int SceneIndex) { + SceneManager.LoadScene(SceneIndex); + } + + public void Start() { + doMenuRotate = false; + MainPanel = GameObject.Find("MainPanel"); + } + + public void Update() { + if (doMenuRotate) { + if (MainPanel.transform.eulerAngles.z < 90) { + MainPanel.transform.Rotate(0, 0, MainPanel.transform.rotation.eulerAngles.z + 0.01f); + } else { + doMenuRotate = false; + } + } + + if (MainPanel.transform.eulerAngles.z > 90) { + SceneLoader(_SceneIndex); + } + } +} -- cgit v1.2.3