public void DeleteActiveFeature() { EnemyLabel temp = activeEnemy; ResetActiveEnemy(); enemies.Remove(temp); }
public EnemyLabel CreateLabel() { EnemyLabel label = new EnemyLabel(); label.id = this.prefix + counter.ToString(); return(label); }
public void AddLabel(EnemyLabel label) { if (false == IsLabelInList(label.id)) { enemies.Add(label); } counter++; }
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); }
public void ResetActiveEnemy() { activeEnemy = null; }
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; } }