generateParticles() публичный Метод

public generateParticles ( ) : void
Результат void
Пример #1
0
        /// <summary>
        /// Allows the component to run logic.
        /// </summary>
        /// <param name="gameTime">The gametime.</param>
        public override void Update(GameTime gameTime)
        {
            if (myGame.paused)
            {
                return;
            }

            foreach (Event ev in events)
            {
                switch (ev.EventId)
                {
                case (int)MyEvent.G_NextLevel_END_OF_MUSIC: reinitializeMonstersTypes(); break;
                }
            }
            events.Clear();

            reaminingTimeToNextSpawn -= gameTime.ElapsedGameTime.Milliseconds;
            if (reaminingTimeToNextSpawn < 0 && monsters.Count < myGame.difficultyConstants.NUM_MONSTERS_IN_FIELD)
            {
                reaminingTimeToNextSpawn = spawnTime;
                addEnemy();
            }
            for (int j = 0; j < monsters.Count; j++)// Monster monster in monsters)
            {
                monsters[j].Update(gameTime);

                if (monsters[j].unit.alive && myGame.player.unit.collideWith(monsters[j].unit))
                {
                    monsters[j].monsterUnit.moving = false;
                    if (monsters[j].ActiveAnimation != MonsterModel.MonsterAnimations.Bite)
                    {
                        monsters[j].Bite();
                        myGame.mediator.fireEvent(MyEvent.M_BITE, "decreasedHealth",
                                                  monsters[j].monsterUnit.monsterConstants.PLAYER_HEALTH_DECREASE);
                    }
                }
                else if (monsters[j].monsterUnit.dead)
                {
                    deadMonsters.Add(monsters[j]);
                    monsters.RemoveAt(j);
                    hpBillBoardSystem.monstersTextures.RemoveAt(j);
                    monsters[j].Dispose();
                    j--;
                }
            }

            if (monsters.Count != 0)
            {
                hpBillBoardSystem.generateParticles();
            }
            base.Update(gameTime);
        }
Пример #2
0
        public override void Update(GameTime gameTime)
        {
            if (myGame.paused)
            {
                return;
            }

            reaminingTimeToNextSpawn -= gameTime.ElapsedGameTime.Milliseconds;
            if (reaminingTimeToNextSpawn < 0 && monsters.Count < myGame.difficultyConstants.NUM_MONSTERS_IN_FIELD)
            {
                reaminingTimeToNextSpawn = spawnTime;
                addEnemy();
            }
            for (int j = 0; j < monsters.Count; j++)// Monster monster in monsters)
            {
                monsters[j].Update(gameTime);

                if (monsters[j].unit.alive && myGame.player.unit.collideWith(monsters[j].unit))
                {
                    monsters[j].monsterUnit.moving = false;
                    if (monsters[j].ActiveAnimation != MonsterModel.MonsterAnimations.Bite)
                    {
                        monsters[j].Bite();
                        myGame.mediator.fireEvent(MyEvent.M_BITE);
                    }
                }
                else if (monsters[j].monsterUnit.dead)
                {
                    monsters.RemoveAt(j);
                    hpBillBoardSystem.monstersTextures.RemoveAt(j);
                    j--;
                }
            }

            if (monsters.Count != 0)
            {
                hpBillBoardSystem.generateParticles();
            }
            base.Update(gameTime);
        }