예제 #1
0
        public void EndList(ActionList _list)
        {
            if (IsListRunning(_list))
            {
                activeLists.Remove(_list);
            }

            _list.Reset();

            if (_list.conversation == conversationOnEnd && _list.conversation != null)
            {
                if (KickStarter.stateHandler)
                {
                    KickStarter.stateHandler.gameState = GameState.Cutscene;
                }
                else
                {
                    Debug.LogWarning("Could not set correct GameState!");
                }

                ResetSkipVars();
                conversationOnEnd.Interact();
                conversationOnEnd = null;
            }
            else
            {
                if (_list is RuntimeActionList && _list.actionListType == ActionListType.PauseGameplay && !_list.unfreezePauseMenus && KickStarter.playerMenus.ArePauseMenusOn(null))
                {
                    // Don't affect the gamestate if we want to remain frozen
                    if (KickStarter.stateHandler.gameState != GameState.Cutscene)
                    {
                        ResetSkipVars();
                    }
                }
                else
                {
                    SetCorrectGameStateEnd();
                }
            }

            if (_list.autosaveAfter)
            {
                if (!IsGameplayBlocked())
                {
                    SaveSystem.SaveAutoSave();
                }
                else
                {
                    saveAfterCutscene = true;
                }
            }

            if (_list is RuntimeActionList)
            {
                RuntimeActionList runtimeActionList = (RuntimeActionList)_list;
                runtimeActionList.DestroySelf();
            }
        }
예제 #2
0
        public void EndCutscene()
        {
            if (!IsGameplayBlocked())
            {
                return;
            }

            if (AdvGame.GetReferences().settingsManager.blackOutWhenSkipping)
            {
                KickStarter.mainCamera.HideScene();
            }

            // Stop all non-looping sound
            Sound[] sounds = FindObjectsOfType(typeof(Sound)) as Sound[];
            foreach (Sound sound in sounds)
            {
                if (sound.GetComponent <AudioSource>())
                {
                    if (sound.soundType != SoundType.Music && !sound.GetComponent <AudioSource>().loop)
                    {
                        sound.Stop();
                    }
                }
            }

            for (int i = 0; i < activeLists.Count; i++)
            {
                if (!ListIsInSkipQueue(activeLists[i]) && activeLists[i].IsSkippable())
                {
                    // Kill, but do isolated, to bypass setting GameState etc
                    ActionList listToRemove = activeLists[i];
                    listToRemove.Reset();
                    activeLists.RemoveAt(i);
                    i -= 1;

                    if (listToRemove is RuntimeActionList)
                    {
                        Destroy(listToRemove.gameObject);
                    }
                }
            }

            for (int i = 0; i < skipQueue.Count; i++)
            {
                skipQueue[i].Skip();
            }
        }