// System using statements using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Net; using Microsoft.Xna.Framework.Storage; // Local using statements using XNAEngine; using CollisionDetection; using LinearAlgebra; //namespace XNACollisionDetection { public enum player_status_info { Normal, Invulnerability, Invisibility } string player_status = "Normal"; float invulnerable_time = 0; float invisible_time = 0; float dead_time = 0; void pickUp_Invulnerability() { player_status = "Invulnerable"; invulnerable_time = 15.0f; } void pickUp_Invisible() { player_status = "Invisible"; invisible_time = 15.0f; } void player_die() { player_status = "Dead"; dead_time = 6.0f; } void DrawPlayerStatus(GameTime gameTime) { //call this in draw() if (player_status == "Invulnerable") { graphics.GraphicsDevice.RenderState.FogColor = Color.WhiteSmoke; graphics.GraphicsDevice.RenderState.FogStart = 1.0f; graphics.GraphicsDevice.RenderState.FogEnd = 4000.0f; graphics.GraphicsDevice.RenderState.FogTableMode = FogMode.Exponent; graphics.GraphicsDevice.RenderState.FogVertexMode = FogMode.Exponent; graphics.GraphicsDevice.RenderState.FogDensity = 0.015f; graphics.GraphicsDevice.RenderState.FogEnable = true; } else if (player_status == "Invisible") { graphics.GraphicsDevice.RenderState.FogColor = Color.LightSteelBlue; graphics.GraphicsDevice.RenderState.FogStart = 1.0f; graphics.GraphicsDevice.RenderState.FogEnd = 4000.0f; graphics.GraphicsDevice.RenderState.FogTableMode = FogMode.Exponent; graphics.GraphicsDevice.RenderState.FogVertexMode = FogMode.Exponent; graphics.GraphicsDevice.RenderState.FogDensity = 0.015f; graphics.GraphicsDevice.RenderState.FogEnable = true; } else if (player_status == "Dead") { graphics.GraphicsDevice.RenderState.FogColor = Color.Red; graphics.GraphicsDevice.RenderState.FogStart = 1.0f; graphics.GraphicsDevice.RenderState.FogEnd = 4000.0f; graphics.GraphicsDevice.RenderState.FogTableMode = FogMode.Exponent; graphics.GraphicsDevice.RenderState.FogVertexMode = FogMode.Exponent; graphics.GraphicsDevice.RenderState.FogDensity = 0.04f; graphics.GraphicsDevice.RenderState.FogEnable = true; } else graphics.GraphicsDevice.RenderState.FogEnable = false; } void PlayerStatusUpdate(GameTime gameTime) { //call this in Update() dt = (float)gameTime.ElapsedGameTime.TotalSeconds; if (invisible_time > 0) { invisible_time -= dt; } if (invulnerable_time > 0) invulnerable_time -= dt; if (player_health <= 0 && player_status != "Dead") { player_die(); player_health = 0; } if (player_status == "Dead" && dead_time > 0) { dead_time -= dt; } else if (player_status == "Dead" && dead_time <= 0) { player_respawn(); } if (player_status == "Dead" && dead_time <= 0) { player_respawn(); player_status = "Normal"; } if (player_status == "Invulnerable" && invulnerable_time <= 0) { player_status = "Normal"; } if (player_status == "Invisible" && invisible_time <= 0) { player_status = "Normal"; } } private void DrawParticles() { // Pass camera matrices through to the particle system components. explosionParticles.SetCamera(camera.View, camera.Projection); explosionSmokeParticles.SetCamera(camera.View, camera.Projection); projectileTrailParticles.SetCamera(camera.View, camera.Projection); smokePlumeParticles.SetCamera(camera.View, camera.Projection); fireParticles.SetCamera(camera.View, camera.Projection); if (player_status != "Dead") { flameSpitParticles.Visible = true; flameSpitParticles.SetCamera(camera.View, camera.Projection); } else { flameSpitParticles.Visible = false; } } }