本文整理汇总了C#中GameManager.GetGameState方法的典型用法代码示例。如果您正苦于以下问题:C# GameManager.GetGameState方法的具体用法?C# GameManager.GetGameState怎么用?C# GameManager.GetGameState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameManager
的用法示例。
在下文中一共展示了GameManager.GetGameState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _Countdown
private IEnumerator _Countdown(GameManager manager)
{
GameObject cs = null;
for (int i = counter; i >= 0; i--)
{
float t = 1f;
while (t > 0f) {
if(manager.GetGameState() == GameState.Tutorial)
{
yield return null;
}
else
{
t -= Time.deltaTime;
yield return null;
}
}
if (i != 0)
{
// Numbers
cs = Instantiate(countdownScript, _spawnPosition, Quaternion.identity) as GameObject;
cs.GetComponent<CountdownScript>().SetText(i.ToString());
}
else {
// Go text
cs = Instantiate(countdownScript, _spawnPosition, Quaternion.identity) as GameObject;
cs.GetComponent<CountdownScript>().SetText("GO!");
}
}
_countdownDone = true;
this.enabled = false;
yield return null;
}
示例2: Start
void Start()
{
FadeIn();
_gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
_previousState = _gameManager.GetGameState();
// in-game menu construction
{
float __horizontalOffset = 85f;
float __buttonMargin = 5f;
float __buttonSize = Screen.width / 15f;
_pauseButtonRegion = new Rect(
__horizontalOffset + __buttonMargin,
__buttonMargin,
__buttonSize,
__buttonSize);
_tutorialButtonRegion = _pauseButtonRegion;
_tutorialButtonRegion.x += __buttonSize;
}
// pause menu construction - regular buttons
{
float __horizontalOffset = 190f;
float __verticalOffset = Screen.height - 205f;
float __buttonMargin = 242f;
float __buttonSize = Screen.width / 10f;
_mainMenuButtonRegion = new Rect(
__horizontalOffset,
__verticalOffset,
__buttonSize,
__buttonSize);
_restartButtonRegion = _mainMenuButtonRegion;
_nextLevelButtonRegion = _mainMenuButtonRegion;
_restartButtonRegion.x += __buttonMargin;
_nextLevelButtonRegion.x += __buttonMargin * 2f;
}
// pause menu construction - store button
{
float __verticalOffset = 315f;
float __scalingFactor = 0.85f;
float __buttonWidth = storeButtonOn.width * __scalingFactor;
float __buttonHeight = storeButtonOn.height * __scalingFactor;
_storeButtonRect = new Rect(
Screen.width / 2f - __buttonWidth / 2f,
__verticalOffset,
__buttonWidth,
__buttonHeight);
}
}