[1114] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using Oni.Akira;
|
---|
| 4 | using Oni.Motoko;
|
---|
| 5 | using Oni.Physics;
|
---|
| 6 |
|
---|
| 7 | namespace Oni.Objects
|
---|
| 8 | {
|
---|
| 9 | internal class TurretClass : GunkObjectClass
|
---|
| 10 | {
|
---|
| 11 | public string BaseName;
|
---|
| 12 | public int Flags;
|
---|
| 13 | public int FreeTime;
|
---|
| 14 | public int ReloadTime;
|
---|
| 15 | public int BarrelCount;
|
---|
| 16 | public int RecoilAnimType;
|
---|
| 17 | public int ReloadAnimType;
|
---|
| 18 | public int MaxAmmo;
|
---|
| 19 | public int AttachmentCount;
|
---|
| 20 | public int ShooterCount;
|
---|
| 21 | public float AimingSpeed;
|
---|
| 22 | public Geometry BaseGeometry;
|
---|
| 23 | public GunkFlags BaseGunkFlags;
|
---|
| 24 | public Geometry TurretGeometry;
|
---|
| 25 | public GunkFlags TurretGunkFlags;
|
---|
| 26 | public Geometry BarrelGeometry;
|
---|
| 27 | public GunkFlags BarrelGunkFlags;
|
---|
| 28 | public Vector3 TurretPosition;
|
---|
| 29 | public Vector3 BarrelPosition;
|
---|
| 30 |
|
---|
| 31 | public static TurretClass Read(InstanceDescriptor turr)
|
---|
| 32 | {
|
---|
| 33 | var klass = new TurretClass();
|
---|
| 34 |
|
---|
| 35 | InstanceDescriptor baseGeometryDescriptor;
|
---|
| 36 | InstanceDescriptor turretGeometryDescriptor;
|
---|
| 37 | InstanceDescriptor barrelGeometryDescriptor;
|
---|
| 38 |
|
---|
| 39 | using (var reader = turr.OpenRead())
|
---|
| 40 | {
|
---|
| 41 | klass.Name = reader.ReadString(32);
|
---|
| 42 | klass.BaseName = reader.ReadString(32);
|
---|
| 43 | klass.Flags = reader.ReadUInt16();
|
---|
| 44 | klass.FreeTime = reader.ReadUInt16();
|
---|
| 45 | klass.ReloadTime = reader.ReadUInt16();
|
---|
| 46 | klass.BarrelCount = reader.ReadUInt16();
|
---|
| 47 | klass.RecoilAnimType = reader.ReadUInt16();
|
---|
| 48 | klass.ReloadAnimType = reader.ReadUInt16();
|
---|
| 49 | klass.MaxAmmo = reader.ReadUInt16();
|
---|
| 50 | klass.AttachmentCount = reader.ReadUInt16();
|
---|
| 51 | klass.ShooterCount = reader.ReadUInt16();
|
---|
| 52 | reader.Skip(2);
|
---|
| 53 | klass.AimingSpeed = reader.ReadSingle();
|
---|
| 54 | baseGeometryDescriptor = reader.ReadInstance();
|
---|
| 55 | reader.Skip(4);
|
---|
| 56 | klass.BaseGunkFlags = (GunkFlags)reader.ReadInt32();
|
---|
| 57 | turretGeometryDescriptor = reader.ReadInstance();
|
---|
| 58 | klass.TurretGunkFlags = (GunkFlags)reader.ReadInt32();
|
---|
| 59 | barrelGeometryDescriptor = reader.ReadInstance();
|
---|
| 60 | klass.BarrelGunkFlags = (GunkFlags)reader.ReadInt32();
|
---|
| 61 | klass.TurretPosition = reader.ReadVector3();
|
---|
| 62 | klass.BarrelPosition = reader.ReadVector3();
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | if (baseGeometryDescriptor != null)
|
---|
| 66 | klass.BaseGeometry = GeometryDatReader.Read(baseGeometryDescriptor);
|
---|
| 67 |
|
---|
| 68 | if (barrelGeometryDescriptor != null)
|
---|
| 69 | klass.BarrelGeometry = GeometryDatReader.Read(barrelGeometryDescriptor);
|
---|
| 70 |
|
---|
| 71 | if (turretGeometryDescriptor != null)
|
---|
| 72 | klass.TurretGeometry = GeometryDatReader.Read(turretGeometryDescriptor);
|
---|
| 73 |
|
---|
| 74 | return klass;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | public override ObjectGeometry[] GunkNodes
|
---|
| 78 | {
|
---|
| 79 | get
|
---|
| 80 | {
|
---|
| 81 | return new[] {
|
---|
| 82 | new ObjectGeometry {
|
---|
| 83 | Geometry = BaseGeometry,
|
---|
| 84 | Flags = BaseGunkFlags
|
---|
| 85 | }
|
---|
| 86 | };
|
---|
| 87 | }
|
---|
| 88 | }
|
---|
| 89 | }
|
---|
| 90 | }
|
---|