예제 #1
0
        public void DeleteActiveFeature()
        {
            EnemyLabel temp = activeEnemy;

            ResetActiveEnemy();
            enemies.Remove(temp);
        }
예제 #2
0
        public EnemyLabel CreateLabel()
        {
            EnemyLabel label = new EnemyLabel();

            label.id = this.prefix + counter.ToString();

            return(label);
        }
예제 #3
0
        public void AddLabel(EnemyLabel label)
        {
            if (false == IsLabelInList(label.id))
            {
                enemies.Add(label);
            }

            counter++;
        }
예제 #4
0
 public bool FindActiveEnemy(int x, int y)
 {
     for (int i = 0; i < enemies.Count; i++)
     {
         if (true == enemies[i].Contains(x, y))
         {
             activeEnemy = enemies[i];
             return(true);
         }
     }
     return(false);
 }
예제 #5
0
 public void ResetActiveEnemy()
 {
     activeEnemy = null;
 }
예제 #6
0
        public void LoadFromString(string input)
        {
            try
            {
                using (StringReader sr = new StringReader(input))
                {
                    XmlTextReader xtr = new XmlTextReader(sr);

                    this.enemies.Clear();

                    do
                    {
                        xtr.Read();

                        if (xtr.NodeType == XmlNodeType.None)
                        {
                            return;
                        }
                    }while (!(xtr.NodeType == XmlNodeType.Element && xtr.Name == "Enemy"));


                    while ((xtr.NodeType == XmlNodeType.Element && xtr.Name == "Enemy"))
                    {
                        EnemyLabel label = new EnemyLabel();

                        label.id   = xtr.GetAttribute("ID");
                        label.name = xtr.GetAttribute("Name");
                        label.pos  = label.ReadPoint(xtr.GetAttribute("Pos"));

                        this.enemies.Add(label);

                        xtr.Read();

                        while (!(xtr.NodeType == XmlNodeType.Element && xtr.Name == "Enemy") &&
                               !(xtr.NodeType == XmlNodeType.EndElement && xtr.Name == "enemies"))
                        {
                            xtr.Read();
                            if (xtr.ReadState == ReadState.EndOfFile)
                            {
                                return;
                            }
                        }

                        /*
                         * if (xtr.NodeType != XmlNodeType.None)
                         * {
                         *  xtr.Read();
                         *  if (xtr.ReadState == ReadState.EndOfFile)
                         *  {
                         *      return;
                         *  }
                         * }
                         */
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }