00001 /* 00002 * gather.h 00003 * 00004 * Created on: Mar 20, 2013 00005 * Author: sushil 00006 */ 00007 00008 #ifndef GATHER_H_ 00009 #define GATHER_H_ 00010 00011 #include <command.h> 00012 #include <const.h> 00013 #include <enums.h> 00014 #include <ent.h> 00015 #include <buildings.h> 00016 #include <engine.h> 00017 #include <const.h> 00018 #include <cfloat> 00019 00020 namespace FastEcslent { 00021 /* 00022 Move (Entity *ent, Target *tgt): UnitCommand(ent, MoveCommand, tgt) { 00023 */ 00024 enum GatherState { 00025 MOVETOMINERALS = 1, 00026 GATHERINGMINERALS = 2, 00027 RETURNTOCC = 3, 00028 STOPPED = 4, 00029 00030 NGATHERSTATES 00031 }; 00032 00033 class Gather: public UnitCommand { 00034 private: 00035 GatherState state; 00036 SCVehicle *scv; 00037 bool isMineral; 00038 public: 00039 bool finished; 00040 Minerals *mineralEntity; 00041 Gas *gasEntity; 00042 CommandCenter *commandCenter; 00043 CommandCenter *findNearestCommandCenter(); 00044 00045 Gather(Entity *ent, Target *target);//: UnitCommand(ent, GatherCommand, tgt); 00046 00047 virtual void postProcess(); 00048 virtual bool done(); 00049 virtual void init(); 00050 virtual void tick(double dt); 00051 virtual Command* clone() {}; 00052 00053 void gatherTick(double dt); 00054 void moveToEntityTick(Entity *ent, double dt); 00055 00056 void switchState(GatherState newState); 00057 void switchMoveToState(); 00058 00059 }; 00060 00061 } 00062 00063 #endif /* GATHER_H_ */