Пример #1
0
        private IEnumerator StateLogic()
        {
            while (GlobalState.ScreenTransition)
            {
                yield return(null);
            }

            GlobalState.Dialogue = DialogueManager.GetDialogue("arthur", "alone", 0);

            while (!GlobalState.LastDialogueFinished)
            {
                yield return(null);
            }

            while (!(_collided && offset.X < 0.5f))
            {
                _hurtTimer += GameTimes.DeltaTime;

                offset.X = shadow.offset.X = -3 * (float)Math.Sin((_hurtTimer / HurtTimerMax) * 6.28);

                yield return(null);
            }

            offset.X = shadow.offset.X = 0;
            Play("fall_1");

            SoundManager.PlaySoundEffect("fall_1");

            while (offset.Y > 0)
            {
                offset.Y -= GameTimes.DeltaTime * 30 * (1 + 3 * ((80 - offset.Y) / 80));

                shadow.UpdateShadow(offset.Y / 80);

                yield return(null);
            }

            _dustPillow.Play("poof");
            SoundManager.PlaySoundEffect("dustpoof");
            Play("stunned");

            GlobalState.PUZZLES_SOLVED++;

            GlobalState.screenShake.Shake(0.01f, 0.2f);
            shadow.visible = false;

            while (_waitTimer < WaitTimerMax)
            {
                _waitTimer += GameTimes.DeltaTime;

                yield return(null);
            }

            GlobalState.Dialogue = DialogueManager.GetDialogue("arthur", "alone", 1);

            while (!GlobalState.LastDialogueFinished)
            {
                yield return(null);
            }

            Play("walk_d");

            while (!MathUtilities.MoveTo(ref Position.Y, _initPos.Y + 32, 60))
            {
                yield return(null);
            }

            Play("walk_l");

            while (!_parabola.Tick())
            {
                yield return(null);
            }

            while (!MathUtilities.MoveTo(ref Position.X, _initPos.X - 40, 60))
            {
                yield return(null);
            }

            _preset.Alive = false;
            exists        = false;

            yield break;
        }