source: OniSplit/Objects/DoorClass.cs@ 1144

Last change on this file since 1144 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: 1.7 KB
Line 
1using Oni.Physics;
2
3namespace Oni.Objects
4{
5 internal class DoorClass : GunkObjectClass
6 {
7 public ObjectNode Geometry;
8 public string AnimationName;
9 public ObjectAnimation Animation;
10 public float SoundAttenuation;
11 public int AllowedSounds;
12 public int SoundType;
13 public float SoundVolume;
14 public string OpenSound;
15 public string CloseSound;
16
17 public static DoorClass Read(InstanceDescriptor door)
18 {
19 var klass = new DoorClass();
20
21 InstanceDescriptor geometryDescriptor;
22 InstanceDescriptor animationDescriptor;
23
24 using (var reader = door.OpenRead())
25 {
26 geometryDescriptor = reader.ReadInstance();
27 reader.Skip(4);
28 animationDescriptor = reader.ReadInstance();
29 klass.SoundAttenuation = reader.ReadSingle();
30 klass.AllowedSounds = reader.ReadInt32();
31 klass.SoundType = reader.ReadInt32();
32 klass.SoundVolume = reader.ReadSingle();
33 klass.OpenSound = reader.ReadString(32);
34 klass.CloseSound = reader.ReadString(32);
35 }
36
37 if (geometryDescriptor != null)
38 {
39 klass.Geometry = ObjectDatReader.ReadObjectGeometry(geometryDescriptor);
40 }
41
42 if (animationDescriptor != null)
43 {
44 klass.AnimationName = animationDescriptor.Name;
45 klass.Animation = ObjectDatReader.ReadAnimation(animationDescriptor);
46 }
47
48 return klass;
49 }
50
51 public override ObjectGeometry[] GunkNodes => Geometry.Geometries;
52 }
53}
Note: See TracBrowser for help on using the repository browser.