Exemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            //Kill avalanche if flag is set
            if (TGPAContext.Instance.Map.Flags.GetFlag("endAvalanche"))
            {
                this.endLevel = true;
            }

            //Get the nearest player
            float locP1 = TGPAContext.Instance.Player1.Location.X;
            Player player = TGPAContext.Instance.Player1;

            if (TGPAContext.Instance.Player2 != null)
            {
                float locP2 = TGPAContext.Instance.Player2.Location.X;

                if (locP2 < locP1)
                {
                    player = TGPAContext.Instance.Player2;
                }
            }

            if (!endLevel)
            {
                if ((player.DstRect.Left < TGPAContext.Instance.ScreenWidth / 3) || (firstStepPassed == false))
                {
                    this.location.X += 1f;

                    if (this.location.X > 0)
                    {
                        this.location.X = 0;

                        if (firstStepPassed == false)
                        {
                            this.wpn = new SnowballLauncher();
                            this.firstStepPassed = true;
                        }
                    }
                }
                else if ((player.DstRect.Left > TGPAContext.Instance.ScreenWidth / 3) && (firstStepPassed))
                {
                    this.location.X -= 1f;

                    if (this.location.X < -256)
                    {
                        this.location.X = -256;
                    }
                }
            }
            else
            {
                this.location.X -= 5f;
            }

            //Particules
            for (int i = 0; i < 10; i++)
            {
                Snow s = new Snow(new Vector2(this.location.X + (i * (this.DstRect.Width / 10)) + (this.DstRect.Width / 10), this.location.Y + this.DstRect.Height), RandomMachine.GetRandomVector2(-100f, 20f, 50f, -300f), 2f, RandomMachine.GetRandomInt(0, 4));
                TGPAContext.Instance.ParticleManager.AddParticle(s, false);
            }

            base.Update(gameTime);
        }
        public override void TodoOnDeath()
        {
            //Free a PoulpiSnow
            MovePattern mp = new MovePattern();

            switch (this.Flip)
            {
                case SpriteEffects.FlipHorizontally:
                    mp.AddPoint((int)this.location.X, (int)TGPAContext.Instance.ScreenHeight / 2);
                    mp.AddPoint((int)TGPAContext.Instance.ScreenWidth + 1, (int)TGPAContext.Instance.ScreenHeight / 2);
                    break;

                case SpriteEffects.None:
                    mp.AddPoint((int)this.location.X, (int)TGPAContext.Instance.ScreenHeight / 2);
                    mp.AddPoint(-500, (int)TGPAContext.Instance.ScreenHeight / 2);
                    break;
            }

            Snow s = new Snow(this.location, RandomMachine.GetRandomVector2(-100f, 20f, 50f, -300f), 800f, RandomMachine.GetRandomInt(0, 4));
            TGPAContext.Instance.ParticleManager.AddParticle(s, false);

            PoulpiSnow ps = new PoulpiSnow(this.location, this.scrollValue, null, mp, this.Flip, this.flagsOnDeath);
            TGPAContext.Instance.AddEnemy(ps);

            //base.TodoOnDeath();
        }
Exemplo n.º 3
0
            public override void Update(GameTime gameTime)
            {
                this.visualRotation += 0.15f;

                this.rotation -= RandomMachine.GetRandomFloat(0.001f, 0.01f);

                Snow s = new Snow(this.location, RandomMachine.GetRandomVector2(-10f, 10f, -10f, 10f), 1f, RandomMachine.GetRandomInt(0, 4));
                TGPAContext.Instance.ParticleManager.AddParticle(s, true);

                base.Update(gameTime);
            }