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 public: 00038 bool finished; 00039 Minerals *mineralEntity; 00040 CommandCenter *commandCenter; 00041 CommandCenter *findNearestCommandCenter(); 00042 00043 Gather(Entity *ent, Target *target);//: UnitCommand(ent, GatherCommand, tgt); 00044 00045 virtual void postProcess(); 00046 virtual bool done(); 00047 virtual void init(); 00048 virtual void tick(double dt); 00049 00050 void gatherTick(double dt); 00051 void moveToEntityTick(Entity *ent, double dt); 00052 00053 void switchState(GatherState newState); 00054 void switchMoveToState(); 00055 00056 }; 00057 00058 } 00059 00060 #endif /* GATHER_H_ */