}//eom protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.SkyBlue); spriteBatch.Begin(); switch (gameState) { case GameState.Initialize: //string welcomeText = "3D Rotation Demo"; //spriteBatch.DrawString(largeFont, welcomeText, new Vector2(MARGIN, MARGIN), Color.Black); spriteBatch.DrawString(courierNew, "Press Space to rotate...OR Esc to quit", new Vector2(WindowMargin, WindowHeight - WindowMargin), Color.Blue); spriteBatch.DrawString(courierNew, "Rotation Parameters", new Vector2(WindowMargin, WindowMargin), Color.Black); spriteBatch.DrawString(courierNew, " Roll = " + roll, new Vector2(WindowMargin, WindowMargin * 2), Color.Red); spriteBatch.DrawString(courierNew, "Pitch = " + pitch, new Vector2(WindowMargin, WindowMargin * 3), Color.Purple); spriteBatch.DrawString(courierNew, " Yaw = " + yaw, new Vector2(WindowMargin, WindowMargin * 4), Color.Yellow); spriteBatch.DrawString(courierNew, " Mode = " + rotationMode.ToString(), new Vector2(WindowMargin, WindowMargin * 5), Color.Green); airplane.Draw(gameTime, viewMatrix, worldMatrix, projectionMatrix); break; case GameState.Drawing: spriteBatch.DrawString(courierNew, "Rotation Parameters", new Vector2(WindowMargin, WindowMargin), Color.Black); spriteBatch.DrawString(courierNew, " Roll = " + roll, new Vector2(WindowMargin, WindowMargin * 2), Color.Red); spriteBatch.DrawString(courierNew, "Pitch = " + pitch, new Vector2(WindowMargin, WindowMargin * 3), Color.Purple); spriteBatch.DrawString(courierNew, " Yaw = " + yaw, new Vector2(WindowMargin, WindowMargin * 4), Color.Yellow); spriteBatch.DrawString(courierNew, " Mode = " + rotationMode.ToString(), new Vector2(WindowMargin, WindowMargin * 5), Color.Green); airplane.Draw(gameTime, viewMatrix, worldMatrix, projectionMatrix); break; case GameState.Quit: break; }//end switch spriteBatch.End(); base.Draw(gameTime); }//eom
public override void WriteXml(XmlWriter writer) { base.WriteXml(writer); writer.WriteElementString("RotationMode", RotationMode.ToString()); writer.WriteElementString("LoopMode", LoopMode.ToString()); writer.WriteStartElement("BlendMode"); if (BlendMode == BlendState.Additive) { writer.WriteValue("ADDITIVE"); } else if (BlendMode == BlendState.AlphaBlend) { writer.WriteValue("ALPHA"); } else if (BlendMode == BlendState.NonPremultiplied) { writer.WriteValue("ALPHANP"); } else if (BlendMode == BlendState.Opaque) { writer.WriteValue("OPAQUE"); } else { throw new InvalidOperationException("ParticleSystem: Unrecognized BlendMode"); } writer.WriteEndElement(); WriteVector3(writer, Offset, "Offset"); WriteVector3(writer, RandAngle, "RandAngle"); WriteVector3(writer, Wind, "Wind"); WriteVector3(writer, WindVariation, "WindVariation"); WriteVector3(writer, PositionOffset, "PositionOffset"); WriteVector3(writer, PositionOffsetVariation, "PositionOffsetVariation"); WriteVector3(writer, ParticleRotation, "ParticleRotation"); WriteVector3(writer, ParticleRotationVariation, "ParticleRotationVariation"); WriteVector3(writer, ParticleColor, "ParticleColor"); WriteVector3(writer, ParticleColorVariation, "ParticleColorVariation"); WriteVector2(writer, ParticleSize, "ParticleSize"); WriteVector2(writer, ParticleSizeVariation, "ParticleSizeVariation"); writer.WriteStartElement("Textures"); foreach (Texture2D texture in Textures) { writer.WriteElementString("TexturePath", ResourceManager.Instance.Textures.FirstOrDefault(x => x.Value == texture).Key); } writer.WriteEndElement(); writer.WriteElementString("LifeSpanSec", XmlConvert.ToString(LifespanSec)); writer.WriteElementString("LifeSpanSecVariation", XmlConvert.ToString(LifespanSecVariation)); writer.WriteElementString("FadeInTime", XmlConvert.ToString(FadeInTime)); writer.WriteElementString("FadeInTimeVariation", XmlConvert.ToString(FadeInTimeVariation)); writer.WriteElementString("FadeOutTime", XmlConvert.ToString(FadeOutTime)); writer.WriteElementString("FadeOutTimeVariation", XmlConvert.ToString(FadeOutTime)); writer.WriteElementString("Speed", XmlConvert.ToString(Speed)); writer.WriteElementString("SpeedVariation", XmlConvert.ToString(SpeedVariation)); writer.WriteElementString("DelayMs", XmlConvert.ToString(DelayMs)); writer.WriteElementString("DelayMsVariation", XmlConvert.ToString(DelayMsVariation)); writer.WriteElementString("Mass", XmlConvert.ToString(Mass)); writer.WriteElementString("MassVariation", XmlConvert.ToString(MassVariation)); writer.WriteElementString("ParticleCount", XmlConvert.ToString(ParticleCount)); writer.WriteElementString("IgnoreScale", XmlConvert.ToString(IgnoreScale)); writer.WriteElementString("Stopped", XmlConvert.ToString(Stopped)); writer.WriteElementString("UseGravity", XmlConvert.ToString(UseGravity)); }