public void Update(GameTime gameTime, TileMap tileMap)
 {
     for (int i = 0; i < Enemies.Count; ++i)
     {
         Enemy enemy = Enemies[i];
         if (enemy.Alive)
             enemy.Update(gameTime, tileMap);
         else
         {
             this.Enemies.RemoveAt(i);
             drops++;
         }
     }
 }
 public void ReinitializeMap(int levelID)
 {
     tileMap = new TileMap(levelID);
     tileMap.initializeMap();
 }
        protected override void LoadContent()
        {
            for (int i = 0; i < 9; i++)
            {
                RuneManager.InsertRune(i, 100);
            }

            initializeLevel();
            enemyTexture = Content.Load<Texture2D>("Graphics/Enemy/_Robo1");
            MapArrays.mapListInit();
            tileMap = new TileMap(0);
            tileMap.initializeMap();
            hud.InitializeInterface(this.Content);

            foreach (Infinity_TD.Tiles.Waypoint waypoint in tileMap.WaypointList)
            {
                waypoint.teste = Content.Load<Texture2D>("Graphics/Stuff/Cursor1");
            }

            stageTexture = Content.Load<Texture2D>(@"Graphics\Scenes\floresta");
            font = Content.Load<SpriteFont>("Fonts/menu_font");

            enemyManager = new EnemyManager();

            //for (int i = 0; i < 4; ++i)
            //{
            //    enemyManager.Add(new Enemy(tileMap.SpawnPointList[0].position, enemyTexture));
            //}

            //enemyManager.generateEnemiesWave(tileMap.SpawnPointList[0].position, Content, new EnemyWave(Infinity_TD.GameManager.currentLevel));

            font = Content.Load<SpriteFont>("Fonts/hud_font");

            initializeLevel();

            base.LoadContent();
        }
Пример #4
0
        public void Update(GameTime gameTime, TileMap tileMap)
        {
            if (consumeEffects(gameTime))
                return;

            //if(damageCircle.Intersects(new BoundingSphere(new Vector3(this.Position, 0.0f), enemyAnimation.larguraFrame)))
            //{
            //    this.life = damage;
            //}

            //if (damageTime > 0.0f)
            //{
            //    damageTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

            //    if (damageTime < 15.0f)
            //    {
            //        this.life -= damage;
            //    }
            //    else
            //    {
            //        damageTime = 0.0f;
            //    }

            //}

            //if (isLow())
            //{
            //    elapsedTime += (float) gameTime.ElapsedGameTime.TotalSeconds;

            //    if (elapsedTime > stopTime)
            //    {
            //        stopTime = 0.0f;
            //        elapsedTime = 0.0f;
            //    }
            //    else
            //        return;

            //}

            #region UpdateWaypoints
            foreach (Tiles.Waypoint waypoint in tileMap.WaypointList)
            {
                if (waypoint.area.Contains(this.BoundRect))
                {
                    Infinity_TD.Tiles.Waypoint.Directions directions = waypoint.getDirection();

                    switch (directions)
                    {
                        case Tiles.Waypoint.Directions.UP:
                            if (speed.X != 0)
                            {
                                speed.Y = 0 - Math.Abs(speed.X);
                                speed.X = 0;
                                rotation = MathHelper.ToRadians(0f);

                            }
                            break;
                        case Tiles.Waypoint.Directions.DOWN:
                            if (speed.X != 0)
                            {
                                speed.Y = 0 + Math.Abs(speed.X);
                                speed.X = 0;
                                rotation = MathHelper.ToRadians(180f);

                            }
                            break;
                        case Tiles.Waypoint.Directions.LEFT:
                            if (speed.Y != 0)
                            {
                                speed.X = 0 - Math.Abs(speed.Y);
                                speed.Y = 0;
                                rotation = MathHelper.ToRadians(270f);

                            }
                            break;
                        case Tiles.Waypoint.Directions.RIGHT:
                            if (speed.Y != 0)
                            {
                                speed.X = 0 + Math.Abs(speed.Y);
                                speed.Y = 0;
                                rotation = MathHelper.ToRadians(90f);

                            }
                            break;
                    }
                }
            }

            #endregion

            //UPDATE NEXUS
            foreach (Nexus nexus in tileMap.NexusList)
            {
                if (nexus.area.Contains(BoundRect))
                {
                    GameManager.vidas--;
                    this.life = 0.0f;
                }
            }

            if (life <= 0) this.alive = false;

            enemyAnimation.Update(gameTime, Position);

            Position += speed;
        }