private void LoadNode(XmlElement node) { string id = node.GetAttribute("ID"); GameData data; switch (node.Name) { case "GridSize": GridSize = int.Parse(node.GetAttribute("Pixels"), CultureInfo.InvariantCulture); return; case "Sprite": data = new SpriteData(); Sprites.Add(id, (SpriteData)data); break; case "CrewType": data = new CrewTypeData(); CrewTypes.Add(id, (CrewTypeData)data); break; case "Module": data = new ModuleData(); Modules.Add(id, (ModuleData)data); break; case "Projectile": data = new ProjectileData(); Projectiles.Add(id, (ProjectileData)data); break; case "Resource": data = new ResourceData(); Resources.Add(id, (ResourceData)data); break; case "Trait": data = new TraitData(); Traits.Add(id, (TraitData)data); break; case "Weapon": data = new WeaponData(); Weapons.Add(id, (WeaponData)data); break; case "WorkType": data = new WorkTypeData(); WorkTypes.Add(id, (WorkTypeData)data); break; case "Texture": LoadTexture(node); return; case "String": LoadLocalization(node); return; default: return; //Should throw an exception to inform about invalid node type, maybe. } Uninitialized.Add(new Tuple <GameData, XmlElement>(data, node)); }
public ProjectileLaunchData(XmlElement node, GameDataManager data) { ProjectileData projectile = data.Projectiles[node.GetAttribute("ID")]; float speed = float.Parse(node.GetAttribute("Speed"), CultureInfo.InvariantCulture); float precision = float.Parse(node.GetAttribute("Precision"), CultureInfo.InvariantCulture); }
public ProjectileLaunchData(ProjectileData type, float speed, float precision) { Type = type; Speed = speed; Precision = precision; }