public PrtFile(Stream stream) { using (PrtBinaryReader reader = new PrtBinaryReader(new LittleEndianBitConverter(), stream)) { this.Version = reader.ReadInt32(); this.Emitter = new PrtEmitter(reader); this.Shape = new PrtShape(reader); this.Appearance = new PrtAppearance(reader); this.Opacity = new PrtOpacity(reader); this.Scale = new PrtScale(reader); this.Color = new PrtColor(reader); this.Forces = new PrtForces(reader); this.Collision = new PrtCollision(reader); this.BrgFileName = reader.ReadString(); for (int i = 0; i < this.Color.NumPaletteColors; i++) { this.Color.PaletteColors.Add(reader.ReadTexel()); } for (int i = 0; i < this.Appearance.NumFiles; i++) { this.Appearance.AppearanceWeights.Add(reader.ReadSingle()); } for (int i = 0; i < this.Appearance.NumFiles; i++) { this.Appearance.AppearanceFiles.Add(reader.ReadString()); } for (int i = 0; i < this.Opacity.NumStages; i++) { this.Opacity.OpacityStages.Add(new PrtOpacityStage(reader)); } for (int i = 0; i < this.Scale.NumStages; i++) { this.Scale.ScaleStages.Add(new PrtScaleStage(reader)); } for (int i = 0; i < this.Color.NumStages; i++) { this.Color.ColorStages.Add(new PrtColorStage(reader)); } for (int i = 0; i < this.Collision.NumTypes; i++) { this.Collision.CollisionTypes.Add(new PrtCollisionType(reader)); } } }
public PrtCollisionType(PrtBinaryReader reader) { this.SpawnSystem = reader.ReadBoolean(); this.CollideTerrain = reader.ReadBoolean(); this.CollideWater = reader.ReadBoolean(); this.CollideUnits = reader.ReadBoolean(); this.Result = reader.ReadInt32(); this.NumFileNames = reader.ReadInt32(); this.LingerTime = reader.ReadSingle(); this.LingerTimeVar = reader.ReadSingle(); this.FadeTime = reader.ReadSingle(); this.FadeTimeVar = reader.ReadSingle(); this.EnergyLoss = reader.ReadSingle(); this.EnergyLossVar = reader.ReadSingle(); this.Name = reader.ReadString(); this.FileNames = new List <string>(this.NumFileNames); for (int i = 0; i < this.NumFileNames; i++) { this.FileNames.Add(reader.ReadString()); } }
public PrtCollisionType(PrtBinaryReader reader) { this.SpawnSystem = reader.ReadBoolean(); this.CollideTerrain = reader.ReadBoolean(); this.CollideWater = reader.ReadBoolean(); this.CollideUnits = reader.ReadBoolean(); this.Result = reader.ReadInt32(); this.NumFileNames = reader.ReadInt32(); this.LingerTime = reader.ReadSingle(); this.LingerTimeVar = reader.ReadSingle(); this.FadeTime = reader.ReadSingle(); this.FadeTimeVar = reader.ReadSingle(); this.EnergyLoss = reader.ReadSingle(); this.EnergyLossVar = reader.ReadSingle(); this.Name = reader.ReadString(); this.FileNames = new List<string>(this.NumFileNames); for (int i = 0; i < this.NumFileNames; i++) { this.FileNames.Add(reader.ReadString()); } }