| 1 |
using System; |
| 2 |
using System.Xml; |
| 3 |
using Oni.Metadata; |
| 4 |
using Oni.Xml; |
| 5 |
|
| 6 |
namespace Oni.Objects |
| 7 |
{ |
| 8 |
internal class PowerUp : ObjectBase |
| 9 |
{ |
| 10 |
public PowerUpClass Type; |
| 11 |
|
| 12 |
public PowerUp() |
| 13 |
{ |
| 14 |
TypeId = ObjectType.PowerUp; |
| 15 |
} |
| 16 |
|
| 17 |
protected override void WriteOsd(BinaryWriter writer) |
| 18 |
{ |
| 19 |
writer.Write((uint)Type); |
| 20 |
} |
| 21 |
|
| 22 |
protected override void ReadOsd(BinaryReader reader) |
| 23 |
{ |
| 24 |
Type = (PowerUpClass)reader.ReadUInt32(); |
| 25 |
} |
| 26 |
|
| 27 |
protected override void WriteOsd(XmlWriter xml) |
| 28 |
{ |
| 29 |
xml.WriteElementString("Class", MetaEnum.ToString<PowerUpClass>(Type)); |
| 30 |
} |
| 31 |
|
| 32 |
protected override void ReadOsd(XmlReader xml, ObjectLoadContext context) |
| 33 |
{ |
| 34 |
Type = xml.ReadElementContentAsEnum<PowerUpClass>("Class"); |
| 35 |
} |
| 36 |
} |
| 37 |
} |