Example #1
0
void Player::LoadFromJson(const Json::Value &jsonObj, Space *space)
{
	Pi::player = this;
	Ship::LoadFromJson(jsonObj, space);
	InitCockpit();
	registerEquipChangeListener(this);
}
Example #2
0
Player::Player(ShipType::Id shipId): Ship(shipId)
{
	SetController(new PlayerShipController());
	InitCockpit();

	lua_State *l = Lua::manager->GetLuaState();
	LUA_DEBUG_START(l);

	LuaObject<Player>::PushToLua(this);
	lua_pushcclosure(l, onEquipChangeListener, 1);
	LuaRef lr(Lua::manager->GetLuaState(), -1);
	ScopedTable(m_equipSet).CallMethod("AddListener", lr);
	lua_pop(l, 1);

	LUA_DEBUG_END(l, 0);
}
Example #3
0
void Player::SetShipType(const ShipType::Id &shipId) {
	Ship::SetShipType(shipId);
	registerEquipChangeListener(this);
	InitCockpit();
}
Example #4
0
Player::Player(ShipType::Id shipId): Ship(shipId)
{
	SetController(new PlayerShipController());
	InitCockpit();
	registerEquipChangeListener(this);
}
Example #5
0
void Player::Load(Serializer::Reader &rd, Space *space)
{
	Pi::player = this;
	Ship::Load(rd, space);
	InitCockpit();
}