source: OniSplit/Objects/TriggerClass.cs@ 1115

Last change on this file since 1115 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 2.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using Oni.Akira;
4using Oni.Imaging;
5using Oni.Motoko;
6using Oni.Physics;
7
8namespace 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}
Note: See TracBrowser for help on using the repository browser.