00001 #ifndef __TEAM_H__ 00002 #define __TEAM_H__ 00003 00004 #pragma once 00005 00006 #include "UnitType.h" 00007 #include "TeamUnits.h" 00008 00009 #include "OgreString.h" 00010 #include "OgreVector3.h" 00011 #include "OgreColourValue.h" 00012 #include <vector> 00013 00014 using Ogre::String; 00015 using Ogre::Vector3; 00016 using Ogre::ColourValue; 00017 using std::vector; 00018 00019 namespace ASR 00020 { 00021 // Forward Declarations 00022 class Unit; 00023 class Building; 00024 class TeamBuildings; 00025 class ControlGroup; 00026 class TeamUpdater; 00027 class FogOfWar; 00028 00038 // ---------------------------------------------------------------------------- 00039 class Team 00040 { 00041 friend class TeamUpdater; 00042 00043 // Data Storage 00044 // ---------------------------------------------------------------------------- 00045 private: 00046 TeamUnits* mUnits; 00047 TeamBuildings* mBuildings; 00048 FogOfWar* mFogOfWar; 00049 00050 TeamUpdater* mUpdater; 00051 00052 typedef vector<ControlGroup*> ControlGroups; 00053 ControlGroups mControlGroups; 00054 ControlGroup* mActiveGroup; 00055 00056 String mName; 00057 00058 // HACKS 00059 String mBaseMaterialName; 00060 String mFeathersMaterialName; 00061 //String mShieldMaterialName; 00062 String mShoulderMaterialName; 00063 00064 00065 // Construction 00066 // ---------------------------------------------------------------------------- 00067 public: 00072 Team ( const String& name, const ColourValue& teamColor ); 00073 00075 ~Team (); 00076 00077 00078 // ---------------------------------------------------------------------------- 00079 public: 00081 const String& getName () const; 00082 00083 00084 // Creation Methods 00085 // ---------------------------------------------------------------------------- 00086 public: 00093 Unit* createUnit ( const UnitType& unitType ); 00094 00095 00104 Building* createBuilding ( const String& meshName, const Vector3& position ); 00105 00106 private: 00111 void _applyTeamColors ( Unit* unit ); 00112 00113 00118 void _applyTeamColors ( Building* building ); 00119 00120 00121 // Control Groups 00122 // ---------------------------------------------------------------------------- 00123 public: 00124 ControlGroup* createControlGroup (); 00125 void destroyControlGroup ( ControlGroup* group ); 00126 00130 void setActiveControlGroup ( ControlGroup* group ); 00131 void destroyActiveControlGroup (); 00132 ControlGroup* getActiveControlGroup () const; 00133 00134 private: 00135 void _destroyAllControlGroups (); 00136 00137 00138 // Unit Management 00139 // ---------------------------------------------------------------------------- 00140 public: 00142 TeamUnits::UnitIterator getUnitIterator () const; 00143 00148 TeamUnits::UnitList getAdjacentUnits ( const Vector3& worldPos, float radius ); 00149 00150 00151 // Misc Methods 00152 // ---------------------------------------------------------------------------- 00153 public: 00154 FogOfWar* getFogOfWar () const; 00155 00156 00157 // Update Methods 00158 // ---------------------------------------------------------------------------- 00159 public: 00160 void findTargets (); 00161 }; 00162 } 00163 00164 #endif