Ejemplo n.º 1
0
 private void writeEnemyZone(XmlTextWriter writer, EnemySpawnZone esz)
 {
     writer.WriteStartElement("enemySpawnZone");
     writer.WriteAttributeString("zone", esz.getZone().toXML());
     writer.WriteAttributeString("enemy", esz.getEnemyName());
     writer.WriteAttributeString("count", esz.getTotalSpawns().ToString());
     writer.WriteEndElement();
 }
Ejemplo n.º 2
0
 public void addEnemySpawnZone(EnemySpawnZone enemySpawnZone)
 {
     enemySpawnZones.Add(enemySpawnZone);
 }
        public override void update()
        {
            base.update();

            if (justPressedLeftButton() && isPosInScreen(gameScreenPos))
            {
                zone = null;
                Point p = mouseInSetaZero.toVector2().toPoint();
                foreach (EnemySpawnZone e in EnemyManager.Instance.getEnemySpawnZones())
                {
                    if (e.getZone().Contains(p))
                    {
                        zone = e;
                        break;
                    }
                }
                if (zone != null)
                {
                    MyEditor.Instance.enemiesCombo.Text = zone.getEnemyName();
                    MyEditor.Instance.enemyCount.Text = zone.getTotalSpawns().ToString();
                }
            }

            if (justPressedKey(Keys.Delete) && zone != null)
            {
                EnemyManager.Instance.getEnemySpawnZones().Remove(zone);
                zone = null;
            }
            else if (zone != null && mouseState.LeftButton == ButtonState.Pressed && isPosInScreen(gameScreenPos))
            {
                Vector2 current = new Vector2(mouseState.X, mouseState.Y);
                Vector2 last = new Vector2(lastMouseState.X, lastMouseState.Y);

                Rectangle rect = zone.getZone();
                Point location = rect.Location;
                location.X += (int)(current.X - last.X);
                location.Y -= (int)(current.Y - last.Y);
                rect.Location = location;
                zone. setZone(rect);
            }
        }