/* * UFO.cs * Authors: August Zinsser, Adam Nabinger * Copyright (c) 2007-2008 Cornell University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using Microsoft.Xna.Framework; namespace MaritimeDefender { /// /// 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 { // Shield power. If this drops below 0, the UFO should die protected float mHitPoints = 100; // Size of this entity in space3D coordinates protected Vector3 mSpace3DSize; public bool Alive { set { mAlive = value; } 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(string texturePath, float width, float height, float depth, float hitPoints) : base(texturePath) { mSpace3DSize = new Vector3(width, height, depth); mHitPoints = hitPoints; } /// /// 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) { } } }