ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/OniSplit/Objects/PowerUp.cs
Revision: 1114
Committed: Wed Jan 22 14:08:57 2020 UTC (5 years, 8 months ago) by iritscen
File size: 900 byte(s)
Log Message:
Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File Contents

# Content
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 }