Exemplo n.º 1
0
        private IEnumerator IncorrectFlashPickupsOrderSequence(FlashbackPickup flashbackPickup)
        {
            //Message to player
            GameHud.Instance.ShowTextBox(Settings.Flashback_Pickups_Incorrect_Order_Message);

            //Disable all indicators
            GameHud.Instance.MemoriesHudPanel.DisableAllIndicators();

            yield return(new WaitForMilliSeconds(1000));

            _collectedFlashPickupsNames.Clear();

            _level.Player.InputEnabled = true;

            //Wait for player get out of the last pickedup to reenable all
            while (flashbackPickup.HitTest(_level.Player))
            {
                yield return(null);
            }

            yield return(new WaitForMilliSeconds(Settings.Default_AlphaTween_Duration));

            flashbackPickup.visible = true;
            DrawableTweener.TweenSpriteAlpha(flashbackPickup, 0, 1, Settings.Default_AlphaTween_Duration);

            FlashbackPickupsManager.Instance.EnableFlashbackPickups();
        }
Exemplo n.º 2
0
        private IEnumerator PlayCoinsExplosionRoutine(GameObject target, float offSetX, float offSetY)
        {
            int time     = 0;
            int duration = 1200;

            yield return(null);

            _cartoonCoinsExplosion.SetActive(true);
            target.AddChild(_cartoonCoinsExplosion);
            _cartoonCoinsExplosion.SetXY(0 + offSetX, 0 + offSetY);
            _cartoonCoinsExplosion.alpha = 1f;

            DrawableTweener.TweenSpriteAlpha(_cartoonCoinsExplosion, 1, 0, duration - 500, Easing.Equation.QuadEaseOut,
                                             500);

            while (time < duration)
            {
                float fFrame = Mathf.Map(time, 0, duration, 0, _cartoonCoinsExplosion.frameCount - 1);
                int   frame  = Mathf.Round(fFrame) % _cartoonCoinsExplosion.frameCount;

                _cartoonCoinsExplosion.SetFrame(frame);

                time += Time.deltaTime;

                yield return(null);
            }

            yield return(new WaitForMilliSeconds(200));

            target.RemoveChild(_cartoonCoinsExplosion);
            _cartoonCoinsExplosion.SetActive(false);
        }
Exemplo n.º 3
0
        void IHasTrigger.OnEnterTrigger(GameObject other)
        {
            Console.WriteLine($"{this}: OnEnterTrigger -> {other}");

            GameSoundManager.Instance.PlayFx(Settings.History_Pickedup_SFX, Settings.History_Pickedup_SFX_Volume);

            DrawableTweener.TweenSpriteAlpha(this, 1, 0, 200, Easing.Equation.QuadEaseOut, 0, () =>
            {
                GameHud.Instance.ShowHistoricHud(_historyImageFileName);
                this.Destroy();
            });
        }
Exemplo n.º 4
0
        private IEnumerator CorrectFlashPickupsOrderSequence(FlashbackPickup flashbackPickup)
        {
            yield return(new WaitForMilliSeconds(1000));

            var hiddenRoomCover = HiddenRoomCoverManager.Instance.HiddenRoomCover;
            var hiddenCollider  = HiddenRoomCoverManager.Instance.HiddenRoomCoverCollider;

            DrawableTweener.TweenSpriteAlpha(hiddenRoomCover, 1, 0, 1000, Easing.Equation.QuadEaseOut);

            GameSoundManager.Instance.PlayFx(Settings.Hidden_Room_Revealed_SFX);

            yield return(new WaitForMilliSeconds(1400));

            hiddenCollider.Enabled = false;

            _level.Player.InputEnabled = true;
        }
        private void EnablePickup(FlashbackPickup pickup)
        {
            pickup.Enabled = true;

            DrawableTweener.TweenSpriteAlpha(pickup, 0, 1, Settings.Default_AlphaTween_Duration,
                                             () => { pickup.Blink(); });

            DrawableTweener.TweenScale(pickup, Vector2.one, Vector2.one * 1.1f,
                                       Settings.Default_AlphaTween_Duration / 2,
                                       () =>
            {
                DrawableTweener.TweenScale(pickup, Vector2.one * 1.1f, Vector2.one,
                                           Settings.Default_AlphaTween_Duration / 2, () =>
                {
                    pickup.collider.Enabled = true;
                });
            });
        }
Exemplo n.º 6
0
        private IEnumerator PlayerPickedupFlashblackRoutine(FlashbackPickup flashbackPickup, bool showPanel)
        {
            GameHud.Instance.ResetFlashbackButton.collider.Enabled = false;

            //Show FlashbackHud
            if (showPanel)
            {
                yield return(FlashbackHudRoutine(flashbackPickup.FlashbackData.Name));

                GameHud.Instance.ResetFlashbackButton.SetActive(false);

                //Fadeout Music if has one and a property to close it
                if (FlashBackTriggersManager.Instance.FlashTriggersMap.TryGetValue(flashbackPickup.FlashbackData.Name, out var flashTrigger))
                {
                    var closeMusicBool = flashTrigger.FlashbackTriggerData.GetBoolProperty("close_music", false);
                    if (closeMusicBool)
                    {
                        GameSoundManager.Instance.FadeOutCurrentMusic(Settings.Flashbacks_Music_Fadein_Duration);
                        GameSoundManager.Instance.FadeInMusic(Settings.Base_Music, Settings.Background_Music_Volume,
                                                              Settings.Flashbacks_Music_Fadein_Duration);
                    }
                }
            }

            var  flashName     = flashbackPickup.FlashbackData.Name;
            bool alreadyInList = _collectedFlashPickupsNames.Contains(flashName);

            if (!alreadyInList)
            {
                _collectedFlashPickupsNames.Add(flashName);

                if (flashName == "final flashback")
                {
                    CoroutineManager.StopAllCoroutines(flashbackPickup);
                    DrawableTweener.TweenSpriteAlpha(flashbackPickup, flashbackPickup.alpha, 0,
                                                     Settings.Default_AlphaTween_Duration,
                                                     () => { flashbackPickup.Enabled = false; });

                    GameHud.Instance.ShowTextBox("Game Over");

                    Console.WriteLine($"{this} go to END");
                }
                else
                {
                    //Change Indicator
                    if (int.TryParse(flashName.Replace("flashback ", ""), out var flashIndex))
                    {
                        GameHud.Instance.MemoriesHudPanel.EnableIndicator(_collectedFlashPickupsNames.Count - 1);
                    }

                    //The last flashback pickedup is not disabled because we need to test the collision with player
                    //to re-enable it only after player exit the trigger
                    //So make it invisible
                    if (_collectedFlashPickupsNames.Count >= _totalFlashbacks)
                    {
                        _lastPicked = flashbackPickup;
                        CoroutineManager.StopAllCoroutines(flashbackPickup);
                        DrawableTweener.TweenSpriteAlpha(flashbackPickup, flashbackPickup.alpha, 0,
                                                         Settings.Default_AlphaTween_Duration);

                        yield return(CheckPickupsCollectedOrderSquence(flashbackPickup));
                    }
                    else
                    {
                        flashbackPickup.collider.Enabled = false;
                        CoroutineManager.StopAllCoroutines(flashbackPickup);
                        DrawableTweener.TweenSpriteAlpha(flashbackPickup, flashbackPickup.alpha, 0,
                                                         Settings.Default_AlphaTween_Duration, () => { flashbackPickup.Enabled = false; });

                        GameHud.Instance.ResetFlashbackButton.SetActive(true);
                    }
                }
            }

            _level.Player.InputEnabled = true;
        }
 static void BlinkOut(Sprite s, float from, float to, int duration)
 {
     DrawableTweener.TweenSpriteAlpha(s, from, to, duration, Easing.Equation.QuadEaseIn, 0, () => { BlinkIn(s, to, from, duration); });
 }