Пример #1
0
        IEnumerator Logic()
        {
            parabola.ResetTime();
            Position       = startPos;
            velocity       = Vector2.Zero;
            visible        = false;
            shadow.visible = true;
            shadow.Flicker(0.5f);
            Play("move");

            while (shadow._flickering)
            {
                yield return(null);
            }

            visible = true;
            SoundManager.PlaySoundEffect("bubble_1", "bubble_1", "bubble_2", "bubble_3");
            velocity.X = GlobalState.RNG.Next(10, 18);

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

            Play("explode");

            while (!_curAnim.Finished)
            {
                yield return(null);
            }

            SoundManager.PlaySoundEffect("bubble_1", "bubble_1", "bubble_2", "bubble_3");
            exists = false;
        }
Пример #2
0
 public override void Update()
 {
     base.Update();
     if (CurAnimName == "move" && parabola.Tick())
     {
         Play("explode");
         velocity = Vector2.Zero;
         SoundManager.PlaySoundEffect("4sht_pop");
     }
     else if (_curAnim.Finished)
     {
         exists = false;
     }
 }
Пример #3
0
            public BurstBullet(int speed_multiplier) : base(Vector2.Zero, "frog_bullet", 8, 8, Drawing.DrawOrder.FG_SPRITES)
            {
                _multiplier = speed_multiplier + 1;

                parabola = new(this, 16, (float)(0.8 + GlobalState.RNG.NextDouble()));

                shadow = new Shadow(this, new Vector2(3, 2), ShadowType.Normal);

                AddAnimation("move", CreateAnimFrameArray(0, 1), 12);
                AddAnimation("explode", CreateAnimFrameArray(2, 3, 3), 10, false);

                _state = new StateMachineBuilder()
                         .State("Move")
                         .Enter((state) =>
                {
                    Play("move");
                    shadow.exists = true;
                    opacity       = 1.0f;
                })
                         .Update((state, time) =>
                {
                    if (parabola.Tick())
                    {
                        _state.ChangeState("Splash");
                    }
                })
                         .End()
                         .State("Splash")
                         .Enter((state) =>
                {
                    shadow.exists = false;
                    Play("explode");
                    velocity = Vector2.Zero;
                })
                         .Condition(() => _curAnim.Finished, (state) =>
                {
                    exists = false;
                    SoundManager.PlaySoundEffect("bubble_1", "bubble_1", "bubble_2", "bubble_3");
                })
                         .End()
                         .Build();
            }
Пример #4
0
            public BurstBullet() : base(Vector2.Zero, "burst_plant_bullet", 8, 8, Drawing.DrawOrder.FG_SPRITES)
            {
                shadow = new Shadow(this, new Vector2(3, 2), ShadowType.Normal);

                AddAnimation("move", CreateAnimFrameArray(0, 1), 12);
                AddAnimation("explode", CreateAnimFrameArray(2, 3, 4, 4), 10, false);

                _state = new StateMachineBuilder()
                         .State("Move")
                         .Enter((state) =>
                {
                    Play("move");
                    shadow.exists = true;
                    opacity       = 1.0f;
                })
                         .Update((state, time) =>
                {
                    if (parabola.Tick())
                    {
                        state.Parent.ChangeState("Splash");
                    }
                })
                         .End()
                         .State("Splash")
                         .Enter((state) =>
                {
                    shadow.exists = false;
                    Play("explode");
                    velocity = Vector2.Zero;
                })
                         .Condition(() => _curAnim.Finished, (state) =>
                {
                    exists = false;
                    SoundManager.PlaySoundEffect("4sht_pop");
                })
                         .End()
                         .Build();
            }
Пример #5
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;
        }