D:/simple_rts/include/ControlGroup.h

Go to the documentation of this file.
00001 #ifndef __UNIT_GROUP_H__
00002 #define __UNIT_GROUP_H__
00003 
00004 #pragma once
00005 
00006 #include "OgreVector3.h"
00007 #include <vector>
00008 
00009 using Ogre::Vector3;
00010 using std::vector;
00011 
00012 namespace ASR
00013 {
00014         class Formation;
00015         class Unit;
00016 
00017         class ControlGroup
00018         {
00019         // Data Members
00020         // ----------------------------------------------------------------------------
00021         private:
00022                 bool                    mDirty;
00023                 Formation*              mCurFormation;
00024                 
00025                 typedef vector<Unit*> UnitList;
00026                 UnitList                mUnits;
00027 
00028                 Vector3                 mFormationCenter;
00029                 Vector3                 mDestination;
00030 
00031                 Vector3                 mForward;
00032                 Vector3                 mRight;
00033 
00034 
00035         // Construction
00036         // ----------------------------------------------------------------------------
00037         public:
00038                 ControlGroup ();
00039                 ~ControlGroup ();
00040 
00041                 int addUnit ( Unit* unit );
00042                 void removeUnit ( size_t index );
00043                 void removeUnit ( Unit* unit );
00044                 int getUnitIndex ( Unit* unit );
00045                 size_t getNumUnits ();
00046                 
00047                 Unit* getUnit ( int index );
00048                 Unit* getLeaderUnit ();
00049 
00050         // Positioning
00051         // ----------------------------------------------------------------------------
00052                 Vector3 getFormationCenter ();
00053 
00054                 Vector3 getUnitOffset ( size_t index );
00055                 Vector3 getUnitOffset ( Unit* unit );
00056 
00057                 Vector3 getUnitDestination ( int index );
00058                 Vector3 getUnitDestination ( Unit* unit );
00059 
00060                 void setDestination ( const Vector3& dest );
00061 
00062 
00063 
00064         // ----------------------------------------------------------------------------
00065         public:
00072                 void update ();
00073 
00074 
00075         // Helpers
00076         // ----------------------------------------------------------------------------
00077         protected:
00078                 void _updateFormation ();
00079 
00080                 void _calcCenter ();
00081 
00089                 void _calcOrientation ();
00090         };
00091 }
00092 
00093 #endif

Generated on Sun Jun 25 19:23:43 2006 for Valors End by  doxygen 1.4.7