/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { // Load the model. //currentModel = Content.Load<Model>("Models\\PlayerMarine"); skinnedModel = Content.Load <InstancedSkinnedModel>("Models\\dwarf-lod1"); this.arenaModel = Content.Load <Model>("Arena\\arena-final"); this.dwarfArmy = new DwarfArmy(skinnedModel); this.spriteBatch = new SpriteBatch(this.GraphicsDevice); this.font = this.Content.Load <SpriteFont>("Fonts\\Font"); }
public DwarfArmy(InstancedSkinnedModel model) { this.dwarfModel = model; this.meshPartCount = new int[this.dwarfModel.Meshes.Count]; for (int i = 0; i < this.dwarfModel.Meshes.Count; i++) { this.meshInstances.Add(new InstancingData()); } // Read the dwarf positions from the Positions.txt file FileStream fs = new FileStream(Path.Combine(StorageContainer.TitleLocation, "Data\\Positions.txt"), FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); while (!sr.EndOfStream) { string sz = sr.ReadLine(); string[] items = sz.Split('{', ',', '}'); Matrix transform = CreateMatrixFromSplitString(items); Dwarf dwarf = new Dwarf(transform.Translation, this.dwarfModel.SkinningData); this.dwarves.Add(dwarf); } }