Пример #1
0
 void Start()
 {
     //TODO: maybe do other things before starting the game
     //go to start if we are in main scene
     SceneManager.Scene mainScene = SceneManager.Scene.main;
     if (Application.loadedLevelName == mainScene.ToString())
     {
         sceneManager.LoadScene(SceneManager.Scene.start);
     }
     else
     {
         sceneManager.InitScene();
     }
 }
Пример #2
0
        /// <summary>
        /// When completed fade of scene then kick this callback.
        /// </summary>
        /// <param name="scene">Current scene</param>
        private async void OnCompletedFadeIn(SceneManager.Scene scene)
        {
            if (scene != SceneManager.Scene.Title)
            {
                return;
            }

            // タイトル再生->bgm 再生->ボタン表示
            await titleUI.PlayAsync(TitleUI.Tag.Init);

            AudioManager.Instance.PlayBGM(BGM_ID.Title, bgmFadeDuration);

            await buttonUI.PlayAsync(ButtonUI.Tag.Init);

            buttonUI.button.interactable = true;
        }
    void Update()
    {
        if(tempScene != sceneManager.scene)
        {
            foreach(Scene scene in hostileScenes)
            {
                if (scene.npcName == "Rats3c" && scene.dialogueEnd)
                {
                    foreach (Collider c in collidersToRemove)
                    {
                        c.enabled = false;
                    }

                    turnHostile = true;
                }
                else if(!scene.npcName.Contains("Rats3") && scene.dialogueEnd)
                {
                    foreach (Collider c in collidersToRemove)
                    {
                        c.enabled = false;
                    }

                    turnHostile = true;
                }
            }

            tempScene = sceneManager.scene;
        }

        if (turnHostile && gameManager.state == GameManager.State.Nav || gameManager.state == GameManager.State.End)
        {
            GetComponent<EnemyInfo>().enabled = true;
            GetComponent<rotateEnemy> ().watchRange = 1000;
            tag = "Enemy";
            GetComponent<NPCDialogue>().enabled = false;
            turnHostile = false;
        }
    }
 void Start()
 {
     sceneManager = GameObject.FindObjectOfType<SceneManager>();
     tempScene = sceneManager.scene;
     gameManager = GameObject.FindObjectOfType<GameManager>();
 }