当前位置: 首页>>代码示例>>C#>>正文


C# GameManager.GetGameState方法代码示例

本文整理汇总了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;
    }
开发者ID:hilvi,项目名称:MimmitAndroid,代码行数:35,代码来源:CountdownManager.cs

示例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);
        }
    }
开发者ID:hilvi,项目名称:MimmitAndroid,代码行数:56,代码来源:InGameMenuGUI.cs


注:本文中的GameManager.GetGameState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。