public SharedData() { hero = null; enemies = new List<PlaneObj>(); heroBullets = new List<BulletObj>(); enemyBullets = new List<BulletObj>(); inactiveEnemies = new List<PlaneObj>(); inactiveHeroBullets = new List<BulletObj>(); inactiveEnemyBullets = new List<BulletObj>(); }
/* setBulletType's subproblem */ private void setBulletTypeSub(PlaneObj plane, string value) { foreach (string input in getStringsFromValue(value, ',')) plane.addBulletType(bulletObjs[input]); }
private void convertPlaneObj(XmlTag element) { string key = ""; MoveableSpriteObj baseObj = null; PlaneObj value = null; int hp = 0; foreach (KeyValuePair<string, string> attrib in element.Attributes) { if (attrib.Key == "id") key = attrib.Value; else if (attrib.Key == "moveablespriteobj") baseObj = moveableSpriteObjs[attrib.Value]; else if (attrib.Key == "hp") hp = Int32.Parse(attrib.Value); } value = new PlaneObj(baseObj.sprite, 0, 0, (int)baseObj.velocity.X, (int)baseObj.velocity.Y, baseObj.srcRect.Width, baseObj.srcRect.Height, baseObj.MoveRate, hp); value.ID = key; planeObjs.Add(key, value); }