private async void Awake()
        {
            if (darkObjects.Any())
            {
                darkObjects.ForEach(o => o.gameObject.SetActive(false));
            }
            else
            {
                Debug.LogError($"Dark objects are missing in {nameof(InteractionManager)}");
            }

            if (lightObjects.Any())
            {
                lightObjects.ForEach(o => o.gameObject.SetActive(false));
            }
            else
            {
                Debug.LogError($"Light objects are missing in {nameof(InteractionManager)}");
            }

            introCinematic.onCinematicFinishedEvent += FirstPhase;
            await Task.Delay(TimeSpan.FromSeconds(0.2));

            await introCinematic.PlayCinematicAsync();
        }
        public async Task NextPhase()
        {
            if (_lightPhase)
            {
                await EvaluateWinCondition();

                return;
            }

            if (_nextDarkPhaseCounter < darkObjects.Count)
            {
                darkObjects[_nextDarkPhaseCounter].gameObject.SetActive(true);
                darkObjects[_nextDarkPhaseCounter].UpdateParentSprite();
                _nextDarkPhaseCounter++;
                return;
            }

            FindObjectOfType <MusicManager>().PlayEndMusic();
            await Task.Delay(TimeSpan.FromSeconds(5));

            await acceptanceCinematic.PlayCinematicAsync();

            await Task.Delay(TimeSpan.FromSeconds(3));

            _lightPhase = true;
            lightObjects.ForEach(o => o.gameObject.SetActive(true));
            lightObjects.ForEach(o => o.UpdateParentSprite());
        }
        private async Task EvaluateWinCondition()
        {
            if (lightObjects.Exists(o => !o.done))
            {
                return;
            }

            outroCinematic.onCinematicFinishedEvent += OutroFinished;
            await outroCinematic.PlayCinematicAsync();
        }
Exemple #4
0
        private async void OnInteraction()
        {
            if (wanderingWhispers.Length > 0)
            {
                eventInstance.setParameterByName("Cinematic", 1);
            }

            var musicManager = FindObjectOfType <MusicManager>();

            done = true;
            switch (objectEnum)
            {
            case ObjectEnum.DollLight:
                break;

            case ObjectEnum.DollDark:
                musicManager.SetAnger(true);
                break;

            case ObjectEnum.SandboxLight:
                break;

            case ObjectEnum.SandboxDark:
                break;

            case ObjectEnum.PuddleLight:
                break;

            case ObjectEnum.PuddleDark:
                break;

            case ObjectEnum.BenchLight:
                break;

            case ObjectEnum.BenchDark:
                musicManager.SetDepression(true);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            _cinematic.onCinematicFinishedEvent += AfterInteraction;
            await _cinematic.PlayCinematicAsync();
        }