Definition at line 19 of file Cube.h.
Public Types | |
typedef std::vector< Cube * > | t_models |
enum | eWeight { NONE, LIGHT, HEAVY, FIXED } |
enum | eAction { ACTION_NO, ACTION_FALL, ACTION_MOVE } |
Public Member Functions | |
Cube (const V2 &location, eWeight weight, eWeight power, bool alive, Shape *shape) | |
Create new model. | |
~Cube () | |
Delete all member but not field. | |
void | setGoal (const Goal &goal) |
void | setIndex (int model_index) |
int | getIndex () const |
bool | isBusy () const |
void | setBusy (bool busy) |
void | change_die () |
Die. | |
void | change_goOut () |
Go out of room. | |
void | change_remove () |
Go out of game, e.g. | |
void | change_turnSide () |
void | change_setLocation (V2 loc) |
V2 | getLocation () const |
bool | isAlive () const |
bool | isLeft () const |
bool | isOut () const |
bool | isLost () const |
bool | isSatisfy () const |
bool | isWrong () const |
bool | isWall () const |
bool | shouldGoOut () const |
eWeight | getWeight () const |
eWeight | getPower () const |
const Shape * | shape () const |
Dir::eDir | getLastMoveDir () const |
bool | isOutDir (Dir::eDir dir) const |
void | setOutDir (Dir::eDir outDir) |
void | decOutCapacity () |
Special model 'output_DIR' has capacity to absorb two fishes, then it changes to normal 'item_light'. | |
bool | isTalking () const |
void | takeDialogs (const DialogStack *dialogs) |
bool | isDisintegrated () |
bool | isInvisible () |
Anim * | anim () |
const Anim * | const_anim () const |
Rules * | rules () |
const Rules * | const_rules () const |
virtual std::string | toString () const |
|
|
|
Definition at line 28 of file Cube.h. 00028 { 00029 ACTION_NO, 00030 ACTION_FALL, 00031 ACTION_MOVE 00032 };
|
|
Definition at line 22 of file Cube.h.
|
|
Create new model.
Definition at line 22 of file Cube.cpp. 00025 : m_loc(location), m_goal(Goal::noGoal()) 00026 { 00027 m_index = -1; 00028 m_busy = false; 00029 00030 m_weight = weight; 00031 m_power = power; 00032 m_alive = alive; 00033 m_out = false; 00034 m_lookLeft = true; 00035 m_lost = false; 00036 m_outDir = Dir::DIR_NO; 00037 m_outCapacity = 0; 00038 00039 m_shape = new_shape; 00040 m_rules = new Rules(this); 00041 m_anim = new Anim(); 00042 m_dialogs = NULL; 00043 }
|
|
Delete all member but not field.
Definition at line 48 of file Cube.cpp. 00049 { 00050 //NOTE: rules must be destroyed before shape because they unmask self 00051 delete m_rules; 00052 delete m_shape; 00053 delete m_anim; 00054 }
|
|
Definition at line 92 of file Cube.h. 00092 { return m_anim; }
|
|
Die.
Definition at line 60 of file Cube.cpp. 00061 { 00062 m_alive = false; 00063 anim()->changeEffect(new EffectDisintegrate()); 00064 }
|
|
Go out of room.
Definition at line 70 of file Cube.cpp. 00071 { 00072 m_out = true; 00073 change_remove(); 00074 }
|
|
Go out of game, e.g. disintegrated skeleton. Definition at line 80 of file Cube.cpp. 00081 { 00082 m_lost = true; 00083 m_weight = NONE; 00084 //NOTE: hack, object is moved out 00085 m_loc = V2(-1000, -1000); 00086 }
|
|
Definition at line 66 of file Cube.h. 00066 { m_loc = loc; }
|
|
Definition at line 89 of file Cube.cpp. 00090 { 00091 m_lookLeft = !m_lookLeft; 00092 }
|
|
Definition at line 93 of file Cube.h. 00093 { return m_anim; }
|
|
Definition at line 95 of file Cube.h. 00095 { return m_rules; }
|
|
Special model 'output_DIR' has capacity to absorb two fishes, then it changes to normal 'item_light'.
Definition at line 112 of file Cube.cpp. 00113 { 00114 if (m_outCapacity > 0) { 00115 m_outCapacity--; 00116 if (m_outCapacity == 0) { 00117 m_outDir = Dir::DIR_NO; 00118 m_weight = LIGHT; 00119 } 00120 } 00121 }
|
|
Definition at line 58 of file Cube.h. 00058 { return m_index; }
|
|
Definition at line 95 of file Cube.cpp. 00096 { 00097 return m_rules->getDir(); 00098 }
|
|
Definition at line 68 of file Cube.h. 00068 { return m_loc; }
|
|
Definition at line 79 of file Cube.h. 00079 { return m_power; }
|
|
Definition at line 78 of file Cube.h. 00078 { return m_weight; }
|
|
Definition at line 69 of file Cube.h. 00069 { return m_alive; }
|
|
Definition at line 59 of file Cube.h. 00059 { return m_busy; }
|
|
Definition at line 124 of file Cube.cpp. 00125 { 00126 return m_anim->isDisintegrated(); 00127 }
|
|
Definition at line 130 of file Cube.cpp. 00131 { 00132 return m_anim->isInvisible(); 00133 }
|
|
Definition at line 70 of file Cube.h. 00070 { return m_lookLeft; }
|
|
Definition at line 72 of file Cube.h. 00072 { return m_lost; }
|
|
Definition at line 71 of file Cube.h. 00071 { return m_out; }
|
|
Definition at line 83 of file Cube.h. 00083 { return m_outDir == dir; }
|
|
Definition at line 73 of file Cube.h. 00073 { return m_goal.isSatisfy(this); }
|
|
Definition at line 136 of file Cube.cpp. 00137 { 00138 return (m_dialogs && m_dialogs->isTalking(m_index)); 00139 }
|
|
Definition at line 75 of file Cube.h. 00075 { return m_weight >= Cube::FIXED; }
|
|
Definition at line 74 of file Cube.h. 00074 { return m_goal.isWrong(this); }
|
|
Definition at line 94 of file Cube.h. 00094 { return m_rules; }
|
|
Definition at line 60 of file Cube.h. 00060 { m_busy = busy; }
|
|
Definition at line 56 of file Cube.h. 00056 { m_goal = goal; }
|
|
Definition at line 57 of file Cube.h. 00057 { m_index = model_index; }
|
|
Definition at line 101 of file Cube.cpp. 00102 { 00103 m_outCapacity = 2; 00104 m_outDir = dir; 00105 }
|
|
Definition at line 80 of file Cube.h. 00080 { return m_shape; }
|
|
Definition at line 76 of file Cube.h. 00076 { return m_goal.shouldGoOut(); }
|
|
Definition at line 88 of file Cube.h. 00088 { m_dialogs = dialogs; }
|
|
Definition at line 142 of file Cube.cpp. 00143 { 00144 return ExInfo("model") 00145 .addInfo("loc", m_loc.toString()) 00146 .addInfo("alive", m_alive) 00147 .addInfo("weight", m_weight) 00148 .addInfo("power", m_power) 00149 .addInfo("shape", m_shape->toString()).info(); 00150 }
|