// Update is called once per frame

    void Update()
    {
        playInScene = SceneManager.GetActiveScene().name;
        //Debug.Log("playInScene:"+playInScene);
        if (playInScene == "Map" || playInScene == "Main")
        {
            clip = 0;
            bgmusic.ChangeMusic(clip, waitForSequence, keepTimeAndVolume, trackVolume, fadeIn, fadeOutPrevious);
        }
        if (playInScene == "Level1" || playInScene == "Level2-mod" || playInScene == "Level3-mod" ||
            playInScene == "Level4Scene1MODMOD" || playInScene == "Level5MOD" || playInScene == "Level6MOD" ||
            playInScene == "Level7MOD" || playInScene == "Level8Scene1MOD")
        {
            clip = 1;
            bgmusic.ChangeMusic(clip, waitForSequence, keepTimeAndVolume, trackVolume, fadeIn, fadeOutPrevious);
        }
        if (playInScene == "Level9MOD" || playInScene == "Level10MOD" || playInScene == "Level11MOD" ||
            playInScene == "Level12Scene1MOD" || playInScene == "Level13MOD" || playInScene == "Level14MOD" ||
            playInScene == "Level5MOD" || playInScene == "Level16Scene1MOD")
        {
            clip = 2;
            bgmusic.ChangeMusic(clip, waitForSequence, keepTimeAndVolume, trackVolume, fadeIn, fadeOutPrevious);
        }
        if (playInScene == "Level17MOD" || playInScene == "Level18MOD" || playInScene == "Level19MOD" ||
            playInScene == "Level20Scene1MOD" || playInScene == "Level21MOD" || playInScene == "Level22MOD" ||
            playInScene == "Level23MOD" || playInScene == "Level24Scene1MOD")
        {
            clip = 3;
            bgmusic.ChangeMusic(clip, waitForSequence, keepTimeAndVolume, trackVolume, fadeIn, fadeOutPrevious);
        }

        //handle sounds
        if (isMusicOff)
        {
            this.gameObject.GetComponent <AudioSource> ().volume = 0;
        }
        else
        {
            this.gameObject.GetComponent <AudioSource> ().volume = 1;
        }

        if (isEffectsOff)
        {
            efxSound.volume = 0;
        }
        else
        {
            efxSound.volume = 1;
        }
    }
예제 #2
0
 void Start()
 {
     SettingsController.LoadSettingsData();
     UpdateSliderValues();
     SettingsController.UpdateVolume();
     MusicManager.ChangeMusic(2, true, 1, 1);
 }
 // Start is called before the first frame update
 void Start()
 {
     MusicManager.ChangeMusic(1, true, 1, 1);
     Profile.sprite   = GameDataManager.GetProfileAvatar();
     DisplayName.text = GameData.User.name;
     Email.text       = GameData.User.email;
     Debug.Log(GameData.User.name);
 }
예제 #4
0
    IEnumerator CoroutineIntroduction()
    {
        yield return(new WaitForSeconds(0.2f));

        if (isProduction)
        {
            _musicManager.ChangeMusic(1);
            SceneManager.LoadScene("TitleScene", LoadSceneMode.Additive);
            Scene newScene = SceneManager.GetSceneByName("TitleScene");
            while (!newScene.isLoaded)
            {
                yield return(null);
            }

            SceneManager.SetActiveScene(newScene);
        }
    }
예제 #5
0
    public void ChangeWorldState(WorldState nextWorldState)
    {
        // TODO: Implement switching world state.
        if (nextWorldState == WorldState.Normal)
        {
            DropItem();
            otherCamera.cullingMask = (1 << LayerMask.NameToLayer("Ignore Raycast"))
                                      | (1 << LayerMask.NameToLayer("Default"));
            cylinder.SetActive(false);

            normalPostProcessing_Knight.SetActive(false);
            normalPostProcessing.SetActive(true);

            CurrentWorldState = WorldState.Normal;

//            PlayerMovement.anim.runtimeAnimatorController = player.GetComponent<PlayerMovement>().NormalAnimControl;

//            playerMovement.animatorOverrideController[playerMovement.idleNormal] = playerMovement.idleKnight;
//            playerMovement.animatorOverrideController[playerMovement.runNormal] = playerMovement.runKnight;
            playerMovement.animatorOverrideController[playerMovement.idleNormal] = playerMovement.idleNormal;
            playerMovement.animatorOverrideController[playerMovement.runNormal]  = playerMovement.runNormal;

//            playerMovement.animatorOverrideController.
        }
        else if (nextWorldState == WorldState.Knight)
        {
            otherCamera.cullingMask = (1 << LayerMask.NameToLayer("Ignore Raycast"))
                                      | (1 << LayerMask.NameToLayer("KnightWorld"));
            cylinder.SetActive(true);
            normalPostProcessing_Knight.SetActive(true);
            normalPostProcessing.SetActive(false);

            CurrentWorldState = WorldState.Knight;

//            PlayerMovement.anim.runtimeAnimatorController = player.GetComponent<PlayerMovement>().KnightAnimControl;
            playerMovement.animatorOverrideController[playerMovement.idleNormal] = playerMovement.idleKnight;
            playerMovement.animatorOverrideController[playerMovement.runNormal]  = playerMovement.runKnight;



//            playerMovement.animatorOverrideController[playerMovement.idleKnight] = playerMovement.idleNormal;
//            playerMovement.animatorOverrideController[playerMovement.runKnight] = playerMovement.runNormal;
        }

        musicManager.ChangeMusic(nextWorldState);
        //else if (nextWorldState == WorldState.Astronaut)
        //{
        //    otherCamera.cullingMask = (1 << LayerMask.NameToLayer("Ignore Raycast"))
        //                              | (1 << LayerMask.NameToLayer("KnightWorld"));
        //    cylinder.SetActive(true);
        //    CurrentWorldState = WorldState.Astronaut;

        //    PlayerMovement.anim.runtimeAnimatorController = player.GetComponent<PlayerMovement>().NormalAnimControl;
        //}

        //        Debug.Log($"Changed active WorldState to {CurrentWorldState}");
    }
    // Use this for initialization
    void Start()
    {
        //textLoader = GetComponent<TextLoader>();
        conversationLoader = GetComponent <ConversationLoader>();

        /*
         * if (textLoader.dictionary.ContainsKey(leftCharacterKey))
         * {
         *  leftCharacter = textLoader.dictionary[leftCharacterKey];
         * }
         * else
         * {
         *  Debug.LogError("Left Character is missing");
         * }
         * if (textLoader.dictionary.ContainsKey(rightCharacterKey))
         * {
         *  rightCharacter = textLoader.dictionary[rightCharacterKey];
         * }
         * else
         * {
         *  Debug.LogError("Right Character is missing");
         * }
         * if (textLoader.dictionary.ContainsKey(choicesKey))
         * {
         *  choices = textLoader.dictionary[choicesKey];
         * }
         * else
         * {
         *  Debug.LogError("Choices are missing");
         * }
         */

        choices = conversationLoader.choice;
        script  = conversationLoader.script;

        if (conversationLoader.music.Count > 0)
        {
            Debug.Log("found music! song=" + conversationLoader.music[0]);

            audioManager = FindObjectOfType <MusicManager> ();
            if (audioManager != null)
            {
                audioManager.ChangeMusic(conversationLoader.music[0]);
            }
        }

        currentNode = script [nodeId];

        if (currentNode.stats != null)
        {
            gameController = FindObjectOfType <GameController> ();
            if (gameController != null)
            {
                gameController.gameProgress.UpdateStats(currentNode.stats);
            }
        }
    }
예제 #7
0
    // Start is called before the first frame update
    void Start()
    {
        musicmanager = FindObjectOfType <MusicManager>();

        if (switch_)
        {
            musicmanager.ChangeMusic(nextmusic);
            gameObject.SetActive(false);
        }
    }
예제 #8
0
    IEnumerator CoroutineIntroduction()
    {
        yield return(new WaitForSeconds(2.0f));

        _isActive = true;
        switch (_gameManager.GetGameMode())
        {
        case 0:     // Normal Mode
            _isTutorial = false;
            _spawnManager.ActivateCoroutineNormalMode();
            _musicManager.ChangeMusic(2);
            break;

        case 1:     // Tutorial Mode
            _isTutorial = true;
            _spawnManager.ActivateCoroutineTutorialMode();
            _musicManager.ChangeMusic(3);
            break;
        }
    }
예제 #9
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.name == "Player")
     {
         if (musicmanager.current_music != nextmusic)
         {
             musicmanager.ChangeMusic(nextmusic);
         }
         //gameObject.SetActive(false);
     }
 }
예제 #10
0
    // Begin method called when action starts
    public override void Begin(NarrativeEvent newEvent)
    {
        base.Begin(newEvent);

        type_ = ACTIONTYPE.MUSIC;

        musicManager = MusicManager.musicManager;

        musicManager.ChangeMusic(music_);

        actionRunning_ = false;
    }
예제 #11
0
    public void Damage(int countDamage)
    {
        if (countInvincible == 0)
        {
            duration -= countDamage;
            if (duration <= 0)
            {
                duration = 0;
                switch (phaseCode)
                {
                case 1:
                case 2:
                    isReturned = true;
                    StopCoroutine(currentCoroutine);
                    StartCoroutine("ReturnToNextPhase");
                    break;

                case 3:
                    isReturned = true;
                    ball.DiminishForLevelUp();
                    musicManager.ChangeMusic(0);
                    StopCoroutine(currentCoroutine);
                    StartCoroutine("ReturnToExplosion");
                    break;
                }
                audioSources[1].time = 0.2f;
                audioSources[1].Play();
                mainManager.AddGameScore(300);
            }


            else
            {
                audioSources[0].time = 0.07f;
                audioSources[0].Play();
                countInvincible = 60;
                face.DamageFace();

                mainManager.AddGameScore(30);
            }
        }
    }
예제 #12
0
    public IEnumerator GenerateStage()
    {
        GameObject[] gameObjectsStage = GameObject.FindGameObjectsWithTag("Stage");
        foreach (GameObject gameObjectStage in gameObjectsStage)
        {
            Destroy(gameObjectStage);
        }
        yield return(null);

        Instantiate(prefabsStage[level], new Vector3(0.0f, 0.0f, 0.0f), new Quaternion(0.0f, 0.0f, 0.0f, 0.0f));
        currentStage = GameObject.FindWithTag("Stage").GetComponent <Stage>();
        DestroyAllBlocks();
        DestroyAllSystems();
        yield return(null);

        currentStage.GenerateStage();

        SetDialogStatus(1);
        theBall.SetBall();
        theBall.StopBall();
        theBall.ResetVelocity();
        musicManager.ChangeMusic(currentStage.GetMusicChannel());
    }
예제 #13
0
        public void ChangeRoom(Enter enter)
        {
            GameObject roomObject = enter.GetRoom();

            NewActiveRoom(roomObject);
            mm.ChangeMusic(activeRoom.GetComponent <Room>().musicID);
            //foreach (var room in rooms)
            //{
            //    if(room == roomObject)
            //    {
            //        newActiveRoom(room);
            //        break;
            //    }
            //}
            Transform trans = enter.transform;

            player.transform.position = new Vector3(trans.position.x, trans.position.y, trans.position.z);
            switch (enter.direction)
            {
            case Direction.Left:
                player.transform.Translate(Vector3.left * trans.localScale.x);
                break;

            case Direction.Right:
                player.transform.Translate(Vector3.right * trans.localScale.x);
                break;

            case Direction.Up:
                player.transform.Translate(Vector3.up * trans.localScale.y);
                break;

            case Direction.Down:
                player.transform.Translate(Vector3.down * trans.localScale.y);
                break;
            }
            //Debug.Log(trans.position);
        }
예제 #14
0
 public void ChangeMusic(AudioClip audio)
 {
     MManager.ChangeMusic(audio);
 }
예제 #15
0
    IEnumerator CoroutineIntroduction()
    {
        yield return(new WaitForSeconds(1.0f));

        _musicManager.ChangeMusic(1);
    }
예제 #16
0
 public void MusicManager_ChangeMusic(int index)
 {
     MusicManager.ChangeMusic(index);
 }