Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

MilitaryUnit.h

Go to the documentation of this file.
00001 /*
00002 CS Senior Project 2003
00003 Team : Leftfield
00004 Project : ModernWarfare
00005 Members :
00006 - Russ Christensen              <rchriste@cs.utah.edu>
00007 - Todd Smith                    <tcsmith@cs.utah.edu>
00008 - Usit Duongsaa                 <duongsaa@cs.utah.edu>
00009 Copyright 2003 Russ Christensen, Usit Duongsaa, and Todd Smith. All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00012 
00013 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
00014 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
00015 THIS SOFTWARE IS PROVIDED BY RUSS CHRISTENSEN, USIT DUONGSAA, AND TODD SMITH ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RUSS, USIT, TODD OR OTHER CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00016 */
00017 
00022 #pragma once
00023 
00024 #include "..\AEngine\AEngine.h"
00025 #include "DrawableUnit.h"
00026 #include "BattleUnitStat.h"
00027 #include "Globals.h"
00028 #include "Defs.h"
00029 #include "UniqueID.h"
00030 
00035 class MilitaryUnit : 
00036         public DrawableObject, public UniqueID
00037 {
00038 public:
00040         enum State{IDLE, BUSY, WANTS_TO_STOP};
00041 
00042         MilitaryUnit(Vec3D initalPosition, Player* owner, UnitType unitType, const int armySize, Vec3D unitSize);
00043         virtual ~MilitaryUnit(void);
00044 
00046         virtual void goal(Vec3D destination);
00049         virtual bool contains(Vec3D that) const;
00051         virtual bool around(Vec3D that);
00053         virtual bool collision(const MilitaryUnit* const that) const;
00054         virtual bool fightingCollision(const MilitaryUnit* const that) const;
00055         virtual bool nearEachOther(const MilitaryUnit* const that) const;
00057         virtual void move();
00060         virtual void drawBox() const;
00062         virtual Player* owner() const;
00064         virtual Vec3D color() const;
00066         virtual void drawColor() const;
00068         virtual Vec3D position() const;
00070         virtual Vec3D goalPosition() const;
00072         virtual void setShortcutKey(int key);
00073         virtual int shortcutKey() const;
00074         inline UnitType unitType() const;
00075         inline int armySize() const;
00076         inline bool isIdle() const;
00077         inline bool isMoving() const;
00078 
00079 protected:
00080         Vec3D m_currPos;
00081         Vec3D m_teamColor;
00082         Vec3D m_unitSize;
00083         Vec3D m_direction;
00084         Player* m_pOwner;
00085         UnitType m_unitType;
00086         int m_armySize;
00087         State m_currState;
00088         Vec3D m_collisionSize;
00089         Vec3D m_goalPos;
00090         int m_overheadShortcutKey;
00091 private:
00092 
00093 
00095         MilitaryUnit& operator=(MilitaryUnit& rhs);
00097         MilitaryUnit(MilitaryUnit& rhs);
00098 };
00099 
00100 UnitType MilitaryUnit::unitType() const
00101 {
00102         return m_unitType;
00103 }
00104 
00105 int MilitaryUnit::armySize() const
00106 {
00107         return m_armySize;
00108 }
00109 
00110 bool MilitaryUnit::isIdle() const
00111 {
00112         return m_currState == IDLE;
00113 }
00114 
00115 bool MilitaryUnit::isMoving() const
00116 {
00117         return m_currState == BUSY;
00118 }
00119 
00122 class LightTank :
00123         public MilitaryUnit
00124 {
00125 public:
00126         LightTank(const Vec3D & initialPosition, Player* owner, const int armySize);
00127         virtual ~LightTank(void);
00128 
00129         virtual void draw() const;
00130 private:
00131         Vec3D m_turretSize;
00132 };
00133 
00136 class HeavyTank :
00137         public MilitaryUnit
00138 {
00139 public:
00140         HeavyTank(const Vec3D & initialPosition, Player* owner, const int armySize);
00141         virtual ~HeavyTank(void);
00142 
00143         virtual void draw() const;
00144 private:
00145         Vec3D m_turretSize;
00146 };
00147 
00150 class RocketLauncher :
00151         public MilitaryUnit
00152 {
00153 public:
00154         RocketLauncher(const Vec3D & initialPosition, Player* owner, const int armySize);
00155         virtual ~RocketLauncher(void);
00156 
00157         virtual void draw() const;
00158 };
00159 
00162 class Artillery :
00163         public MilitaryUnit
00164 {
00165 public:
00166         Artillery(const Vec3D & initialPosition, Player* owner, const int armySize);
00167         virtual ~Artillery(void);
00168 
00169         virtual void draw() const;
00170 private:
00171         Vec3D m_turretSize;
00172 };
00173 
00181 class Jet :
00182         public MilitaryUnit
00183 {
00184 public:
00185   enum JetState { CIRCLE, LIFTOFF, MOVING, ARRIVE };
00186   Jet(const Vec3D & initialPosition, Player* owner, const int armySize, const int cityID);
00187   virtual ~Jet(void);
00188 
00189         virtual int getCityID();
00190         virtual void draw() const;
00191         virtual void goal(Vec3D destination);
00192         virtual void move();
00193 private:
00194   Vec3D m_cityCenter;
00195   float m_ang;
00196   float m_liftOffAng;
00197   int   m_cityID;               // the unique ID of the city where the jet flies over
00198   // distance from the center of the city
00199   float m_distFromCity;
00200   Vec3D m_velocity;
00201   JetState m_jetState;
00202   static const float s_dTheta;
00203   static const float s_speed;
00204   static const float s_dZ;
00205 };
00206 
00207 

Generated on Wed Apr 23 05:50:16 2003 for Modern Warfare by doxygen1.3-rc2