[1114] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using Oni.Akira;
|
---|
| 4 | using Oni.Imaging;
|
---|
| 5 | using Oni.Motoko;
|
---|
| 6 | using Oni.Physics;
|
---|
| 7 |
|
---|
| 8 | namespace Oni.Objects
|
---|
| 9 | {
|
---|
| 10 | internal class TriggerClass : GunkObjectClass
|
---|
| 11 | {
|
---|
| 12 | public Color Color;
|
---|
| 13 | public int TimeOn;
|
---|
| 14 | public int TimeOff;
|
---|
| 15 | public float StartOffset;
|
---|
| 16 | public float AnimScale;
|
---|
| 17 | public Geometry RailGeometry;
|
---|
| 18 | public GunkFlags RailGunkFlags;
|
---|
| 19 | public string ActiveSoundName;
|
---|
| 20 | public string HitSoundName;
|
---|
| 21 |
|
---|
| 22 | public static TriggerClass Read(InstanceDescriptor trig)
|
---|
| 23 | {
|
---|
| 24 | var klass = new TriggerClass();
|
---|
| 25 |
|
---|
| 26 | InstanceDescriptor railGeometryDescriptor;
|
---|
| 27 |
|
---|
| 28 | using (var reader = trig.OpenRead())
|
---|
| 29 | {
|
---|
| 30 | klass.Color = reader.ReadColor();
|
---|
| 31 | klass.TimeOn = reader.ReadUInt16();
|
---|
| 32 | klass.TimeOff = reader.ReadUInt16();
|
---|
| 33 | klass.StartOffset = reader.ReadSingle();
|
---|
| 34 | klass.AnimScale = reader.ReadSingle();
|
---|
| 35 | railGeometryDescriptor = reader.ReadInstance();
|
---|
| 36 | reader.Skip(4);
|
---|
| 37 | klass.RailGunkFlags = (GunkFlags)reader.ReadInt32();
|
---|
| 38 |
|
---|
| 39 | // we do not need the emitter and animation for now
|
---|
| 40 | reader.Skip(8);
|
---|
| 41 | //trge = reader.ReadInstanceLink<TRGEInstance>();
|
---|
| 42 | //oban = reader.ReadInstanceLink<OBANInstance>();
|
---|
| 43 |
|
---|
| 44 | klass.ActiveSoundName = reader.ReadString(32) + ".amb";
|
---|
| 45 | klass.HitSoundName = reader.ReadString(32) + ".imp";
|
---|
| 46 | reader.Skip(8);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | if (railGeometryDescriptor != null)
|
---|
| 50 | klass.RailGeometry = GeometryDatReader.Read(railGeometryDescriptor);
|
---|
| 51 |
|
---|
| 52 | return klass;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | public override ObjectGeometry[] GunkNodes
|
---|
| 56 | {
|
---|
| 57 | get
|
---|
| 58 | {
|
---|
| 59 | return new[] {
|
---|
| 60 | new ObjectGeometry {
|
---|
| 61 | Geometry = RailGeometry,
|
---|
| 62 | Flags = RailGunkFlags
|
---|
| 63 | }
|
---|
| 64 | };
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | }
|
---|