/* * UFO.cs * Authors: August Zinsser * * Copyright Matthew Belmonte 2007 */ using System; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using tAC_Engine; using Pina3D.Particles; namespace Astropolis { /// /// Serves as the base class for any ship that comes out of a wormhole in the meteor madness game. /// Enforces that children have hitpoints, must react to getting hit by projectiles, /// can be destroyed, can collide with the player, and have a basic binary response (ie fire or don't fire) /// based on the orientation of itself and the player. /// class UFO : Entity { protected float mHitPoints = 100; // Shield power. If this drops below 0, the UFO should die protected bool mAlive = true; // Is it dead or not protected Vector3 mSpace3DSize; // Size of this entity in space3D coordinates protected Emitter mShieldEmitter; // Shield particle effect public bool Alive { set { mAlive = false; } get { return mAlive; } } public float HitPoints { set { mHitPoints = value; } get { return mHitPoints; } } public override float Width { set { mSpace3DSize.X = value; } get { return mSpace3DSize.X; } } public override float Height { set { mSpace3DSize.Y = value; } get { return mSpace3DSize.Y; } } public override Vector3 Size { get { return mSpace3DSize; } } /// /// Constructor /// /// Image of the ship /// Width of the ship in Space3D coordinates /// Space3D coordinates /// In Spacw3D units /// Max damage to take before dying public UFO(Texture2D texture, float width, float height, float depth, float hitPoints) : base(texture) { mSpace3DSize = new Vector3(width, height, depth); mHitPoints = hitPoints; mSize.Z = mSize.Y; mShieldEmitter = Sparx.LoadParticleEffect(@"Content\Particle Effects\Shield.spx"); } /// /// Basic AI function. Depending on the type of UFO, react should signal different actions /// based on its true/false return value /// /// public virtual bool React(CheetahFighter playerShip) { return false; } /// /// Spawns the appropriate particle effects and/or entities /// public virtual void Destroy() { } /// /// Awards the appropriate resources or damages player /// public virtual void CollideWithPlayer(Entity player) { } /// /// Takes a hit from a photon /// public virtual void GetHit(int damage) { } } }