Example #1
0
        //Updates and calls DeleteBullets for all bullets blastwave
        private static void ManageBullets(GameTime time)
        {
            int loopControl = bullets.Count;

            for (int i = 0; i < loopControl; i++)
            {
                CollisionGrid.Commit(bullets[i]);
                bullets[i].Update(time);
            }
            loopControl = growers.Count;

            for (int i = 0; i < loopControl; i++)
            {
                growers[i].Update(time);
            }
            DeleteBullets(bullets, false);
            DeleteBullets(growers, true);

            for (int i = 0; i < blasts.Count; i++)
            {
                if (blasts[i].HalfDead)
                {
                    blasts.RemoveAt(i);
                }
            }
        }
 public virtual void Update(bool trigger, float time)
 {
     CollisionGrid.Commit((Enemy)this);
     ScreenWrap();
     IsDead = CheckDeath();
     Behave(trigger, time);
     position += velocity;
 }
Example #3
0
        protected override void LoadContent()
        {
            LevelManager.Assemble();
            CollisionGrid.Assemble();

            spriteBatch   = new SpriteBatch(GraphicsDevice);
            rand          = new Random();
            player        = new Player(this);
            eManager      = new EnemyManager(this);
            uILayer       = new UILayer(this, spriteBatch);
            shaderWrapper = new ShaderWrapper(this);
            counter       = new ForceCounter(this);

            ShaderWrapper.ClearBG(Color.SteelBlue);
        }
Example #4
0
        public override void Update(bool trigger, float time)
        {
            if (!FirstInChain)
            {
                CollisionGrid.Commit((Enemy)this);
            }
            else
            {
                CollisionLocation.X = position.X + (float)Math.Cos(angle) * Size;
                CollisionLocation.Y = position.Y + (float)Math.Sin(angle) * Size;
            }
            ScreenWrap();
            IsDead = CheckDeath();
            Behave(trigger, time);
            position += velocity;

            if (Child != null)
            {
                Child.Update(trigger, time);
            }
        }
        public void Update(GameTime time)
        {
            if (ForceCounter.CurrentForce > 99)
            {
                StartSpawns = true;
            }
            if (StartSpawns)
            {
                if (stats.MaxEnemies > (enemies.Count - (EWorm.CurrentBodyPieces - EWorm.CurrentCount)))
                {
                    Spawn();
                }
                CheckHits();
                RemoveDead();
                currentTime += (float)time.ElapsedGameTime.Milliseconds / 1000.0f;
                splitTime   += (float)time.ElapsedGameTime.Milliseconds / 1000.0f;

                bool trigger = ManageTimers();

                UpdateEnemies(trigger, time);
                CollisionGrid.CollideAll();
            }
        }