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


C# GameManager.SetGameState方法代码示例

本文整理汇总了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();
 }
开发者ID:rafedb,项目名称:unity_fsm_basic,代码行数:8,代码来源:InGameMenu.cs

示例2: Awake

    void Awake()
    {
        GM = GameManager.Instance;
        GM.OnStateChange += HandleOnStateChange;

        Debug.Log("game state on awake: " + GM.gameState);

        GM.SetGameState(GameState.MainMenu);
    }
开发者ID:Whojoo,项目名称:design-pattern-test,代码行数:9,代码来源:GameManagerTest.cs

示例3: Awake

	void Awake () {

		GM = GameManager.Instance;
		GM.OnStateChange += HandleOnStateChange;

		Debug.Log("Current game state when Awakes: " + GM.gameState);

		GM.SetGameState(GameState.Intro);
	}
开发者ID:FightingMongeese,项目名称:SurViveVR,代码行数:9,代码来源:GameManagerTest.cs

示例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();
    }
开发者ID:TheLeanMachine,项目名称:SoHairyItsScary,代码行数:12,代码来源:PlayerControl.cs

示例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
    }
开发者ID:achim1234,项目名称:BowlerMan,代码行数:57,代码来源:PlayerController.cs

示例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();
        }
    }
开发者ID:Skipper565,项目名称:Get-Rekt-Saga,代码行数:64,代码来源:GameStateController.cs


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