using System.Collections; using System.Collections.Generic; using UnityEngine; // Tell what is the beginning state of loaded scene public enum OnMapAppearanceMethodEnum { NewGame = 0, LoadGame = 1, Gateway = 2 //maybe respawn too } public enum GameStatus { NewGame = 0, Continue = 1 } public class OnMapAppearanceMethod : MonoBehaviour { public static OnMapAppearanceMethodEnum Gateway { get; set; } // Map status public static GameStatus GameStatus { get; set; } // every script which makes player appear somewhere should change this variable ! ! ! void Awake() { if(GameStatus == null) GameStatus = GameStatus.NewGame; if(Gateway == null) Gateway = OnMapAppearanceMethodEnum.NewGame; } /// /// Set game global state as new game /// /// Marked after pressing "New Game" on Main Menu /// public static void SetNewGameStatus() { GameStatus = GameStatus.NewGame; Gateway = OnMapAppearanceMethodEnum.NewGame; } /// /// Function to check if its new game /// /// public static bool IsNewGame() { return GameStatus == GameStatus.NewGame; } /// /// Function to set game's global state as continued /// /// Markes after pressing "Continue" in Main Menu /// /// In this state we want to use previously saved game data /// public static void SetContinueStatus() { GameStatus = GameStatus.Continue; } /// /// Function to check if its continued game /// /// In this state we want to use previously saved game data /// /// public static bool IsContinue() { return GameStatus == GameStatus.Continue; } /// /// Function to set state as after telkeporting (from another map) /// /// In this case we want to remember that player went through the teleporter previously ! ! /// public static void SetTeleportedStatus() { Gateway = OnMapAppearanceMethodEnum.Gateway; } /// /// Function to check if its continued game but in special game /// /// In this case we want to make sure ourselves that player previously went through the teleporter ! ! /// public static bool IsAfterGateway() { return Gateway == OnMapAppearanceMethodEnum.Gateway; } /// /// Function to check that player just have been started new game /// /// public static bool IsNewGameJustLaunched() { return IsNewGame() && Gateway == OnMapAppearanceMethodEnum.NewGame; } /// /// Function to check that player just started game /// /// public static bool IsJustLaunched() { return (IsNewGame() || IsContinue()) && Gateway == OnMapAppearanceMethodEnum.LoadGame; } }