commandFactory.h

Go to the documentation of this file.
00001 /* 
00002  * File:   commandFactory.h
00003  * Author: chris
00004  *
00005  * Created on September 16, 2013, 10:25 AM
00006  */
00007 
00008 #ifndef COMMANDFACTORY_H
00009 #define COMMANDFACTORY_H
00010 #include "command.h"
00011 #include "enums.h"
00012 #include "commandHelp.h"
00013 #include <deque>
00014 #include "engine.h"
00015 
00016 namespace FastEcslent {
00017     //class Entity;
00018 
00019     enum RequiredTargetType
00020 {
00021     None,
00022     TargetPosition,
00023     TargetEntity,
00024     Either,
00025     Both
00026 };
00027 
00030     class CommandFactory {
00031     public:
00032         CommandFactory(RequiredTargetType requiredTargetType, std::string previewMeshName = "", EntityType targetEntityType = NENTITYTYPES) : requiredTarget(requiredTargetType),previewMeshName(previewMeshName),targetEntityType(targetEntityType) {} ;
00033         CommandFactory(const CommandFactory& orig);
00034         virtual ~CommandFactory();
00040         virtual std::deque<Command*> MakeCommand(Entity* owner, std::pair<int, Ogre::Vector3 > mouseTargets) = 0;
00041         RequiredTargetType requiredTarget;
00042         EntityType targetEntityType;
00043         std::string previewMeshName;
00044     protected:
00045         //Engine   *engine;
00046 
00047     };
00048 
00049     class BuildFactory : public CommandFactory {
00050     public:
00051 
00057         BuildFactory(EntityType spawnEnt) :CommandFactory(None), spawnEnt(spawnEnt) {
00058         };
00059         BuildFactory(const CommandFactory& orig);
00060 
00061         virtual ~BuildFactory() {
00062         };
00063 
00069         virtual std::deque<Command*> MakeCommand(Entity* owner, std::pair<int, Ogre::Vector3 > mouseTargets) {
00070             std::deque<Command*> newCommands;
00071             newCommands.push_back(new BuildCommand(owner, spawnEnt, FastEcslent::ConstructCommand));
00072             return newCommands;
00073         }
00074     private:
00075         EntityType spawnEnt; 
00077     };
00078     
00079     class BuildStructureFactory : public CommandFactory {
00080     public:
00081 
00087         BuildStructureFactory(EntityType spawnEnt,std::string previewMeshName = "", RequiredTargetType requiredTargetType = TargetPosition,EntityType targetEntityType = NENTITYTYPES) :CommandFactory(requiredTargetType,previewMeshName,targetEntityType), spawnEnt(spawnEnt) {
00088         };
00089         BuildStructureFactory(const CommandFactory& orig);
00090 
00091         virtual ~BuildStructureFactory() {
00092         };
00093 
00099         virtual std::deque<Command*>  MakeCommand(Entity* owner, std::pair<int, Ogre::Vector3 > mouseTargets);
00100     private:
00101         EntityType spawnEnt; 
00103     };
00104     
00105     class MoveFactory : public CommandFactory {
00106     public:
00107 
00113         MoveFactory() :CommandFactory(TargetPosition) {
00114         };
00115         MoveFactory(const CommandFactory& orig);
00116 
00117         virtual ~MoveFactory() {
00118         };
00119 
00125         virtual std::deque<Command*> MakeCommand(Entity* owner, std::pair<int, Ogre::Vector3 > mouseTargets) {
00126             std::deque<Command*> newCommands;
00127             newCommands.push_back(createMoveForEnt(owner, mouseTargets.second));
00128             return newCommands;
00129         }
00130     private:
00131         
00132 
00133     };
00134 }
00135 
00136 #endif  /* COMMANDFACTORY_H */
00137 

Generated on Fri Dec 13 14:54:15 2013 for FastECSLent by  doxygen 1.5.4