本文整理汇总了C#中GameManager.SetGameState方法的典型用法代码示例。如果您正苦于以下问题:C# GameManager.SetGameState方法的具体用法?C# GameManager.SetGameState怎么用?C# GameManager.SetGameState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameManager
的用法示例。
在下文中一共展示了GameManager.SetGameState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEnable
void OnEnable()
{
mgr = GetComponent<GameManager>();
mgr.SetGameState(GameManager.GameState.InGameMenu);
Time.timeScale = 0f;
Debug.Log("Paused");
_setup();
}
示例2: Awake
void Awake()
{
GM = GameManager.Instance;
GM.OnStateChange += HandleOnStateChange;
Debug.Log("game state on awake: " + GM.gameState);
GM.SetGameState(GameState.MainMenu);
}
示例3: Awake
void Awake () {
GM = GameManager.Instance;
GM.OnStateChange += HandleOnStateChange;
Debug.Log("Current game state when Awakes: " + GM.gameState);
GM.SetGameState(GameState.Intro);
}
示例4: Awake
void Awake()
{
GM = GameManager.Instance;
GM.OnStateChange += HandleOnStateChange; // register eventhandler for 'OnStateChange' event
Debug.Log("Current game state when Awakes: " + GM.gameState);
Debug.Log("Trigger gamestate change...");
GM.SetGameState(GameState.MAIN_MENU);
positionPlayer();
}
示例5: Start
void Start()
{
// game manager stuff - set state + scene name
GM = GameManager.Instance;
GM.SetGameState(GameState.Countdown);
GM.SetCurrentSceneName(Application.loadedLevelName);
// reset gravity to default
Physics.gravity = new Vector3(0, -9.81f, 0);
rb = GetComponent<Rigidbody>();
rb.isKinematic = true; // player is not able to move during countdown
// reset score + UI elements
count = 0;
SetCountText();
setUIHealth();
winUIText.text = "";
setUpButtons();
gotPointsUIText.gameObject.SetActive(false);
gotPowerUpUIText.gameObject.SetActive(false);
PostprocessingEffectScript.VignetteAmount = 0f;
PostprocessingEffectScript.RedVignetteAmount = 0f;
PostprocessingEffectScript.BlurFactor = 0f;
colorToFadeTo = new Color(1f, 1f, 1f, 0f);
myPanel.CrossFadeColor(colorToFadeTo, 0.0f, true, true);
RawImage1 = GameObject.Find("RawImage1");
RawImage2 = GameObject.Find("RawImage2");
RawImage3 = GameObject.Find("RawImage3");
// set time for specific level
if (GM.currentscene == "daniels_level")
{
timerMax = 50.0f;
timer = timerMax;
}
else if (GM.currentscene == "achims_level_2")
{
timerMax = 55.0f;
timer = timerMax;
}
else if (GM.currentscene == "werners_level_2")
{
timerMax = 55.0f;
timer = timerMax;
}
else
{
timer = timerMax;
}
ten_sec_left = true;
StartCoroutine(startCountDown()); // start countdown
}
示例6: Start
// Use this for initialization
void Start()
{
// Load GameManager
gameManager = GameManager.Instance;
gameManager.OnStateChange += ManageStateChange;
// Load UI screens
gameOverMenu = UIManager.GameOverMenu;
mainMenu = UIManager.MainMenu;
aboutMenu = UIManager.AboutMenu;
hudMenu = UIManager.HudMenu;
highscoreMenu = UIManager.HighscoreMenu;
difficultyMenu = UIManager.DifficultyMenu;
nicknameMenu = UIManager.NicknameMenu;
moreMenu = UIManager.MoreMenu;
tutorial1 = UIManager.Tutorial1;
tutorial2 = UIManager.Tutorial2;
tutorial3 = UIManager.Tutorial3;
tutorial4 = UIManager.Tutorial4;
tutorial5 = UIManager.Tutorial5;
// Load player controller
playerController = GameObject.Find("Player").GetComponent<PlayerController>();
// Disable all menus; enable them as their events are fired
mainMenu.SetActive(false);
aboutMenu.SetActive(false);
gameOverMenu.SetActive(false);
highscoreMenu.SetActive(false);
difficultyMenu.SetActive(false);
nicknameMenu.SetActive(false);
moreMenu.SetActive(false);
tutorial1.SetActive(false);
tutorial2.SetActive(false);
tutorial3.SetActive(false);
tutorial4.SetActive(false);
tutorial5.SetActive(false);
dontAnimateHideNicknameMenu = true;
// Go to menu when the game starts, but don't when it's just restarted
if (gameManager.gameState == GameState.NewGame/* || gameManager.gameState == GameState.Nickname*/)
{
//gameManager.SetGameState(GameState.Menu);
gameManager.SetGameState(GameState.Nickname);
}
// Else the game was restarted and is now in the Playing state
else
{
if (gameManager.gameState != GameState.Playing)
{
Debug.LogError("Unexpected game state - should be Playing! Current game state: " + gameManager.gameState);
}
// Unsubscribe from the event if the game was restarted to prevent duplicate event calls
gameManager.OnStateChange -= ManageStateChange;
hudMenu.SetActive(true);
TriggerHideMenuAnimation();
}
}