本文整理汇总了C++中UnitBase类的典型用法代码示例。如果您正苦于以下问题:C++ UnitBase类的具体用法?C++ UnitBase怎么用?C++ UnitBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UnitBase类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setTarget
void UnitBase::destroy() {
setTarget(NULL);
currentGameMap->removeObjectFromMap(getObjectID()); //no map point will reference now
currentGame->getObjectManager().removeObject(objectID);
currentGame->getHouse(originalHouseID)->decrementUnits(itemID);
unitList.remove(this);
if(isVisible()) {
if(currentGame->randomGen.rand(1,100) <= getInfSpawnProp()) {
UnitBase* pNewUnit = currentGame->getHouse(originalHouseID)->createUnit(Unit_Soldier);
pNewUnit->setHealth(pNewUnit->getMaxHealth()/2);
pNewUnit->deploy(location);
if(owner->getHouseID() != originalHouseID) {
// deviation is inherited
pNewUnit->owner = owner;
pNewUnit->graphic = pGFXManager->getObjPic(pNewUnit->graphicID,owner->getHouseID());
pNewUnit->deviationTimer = deviationTimer;
}
}
}
delete this;
}
开发者ID:katlogic,项目名称:dunelegacy,代码行数:27,代码来源:UnitBase.cpp
示例2: unit_inout_fill
void MapPane::unit_inout_fill( UnitBase* punit, bool bin)
{
//玩家填充
for( UNITOBJ_MAP::iterator iter =players_.begin(); iter != players_.end(); ++iter)
{
UnitBase* pobj =iter->second;
//必须加载数据完成
if( pobj == punit || !pobj->is_initfinish())
continue;
ActorSceneExtPane* ext1 =punit->get_scene_ext<ActorSceneExtPane>();
ActorSceneExtPane* ext2 =pobj->get_scene_ext<ActorSceneExtPane>();
if( bin)
{
ext1->join_inview( pobj);
ext2->join_inview( punit);
}
else
{
ext1->join_outview( pobj);
ext2->join_outview( punit);
}
}
}
开发者ID:roseboych,项目名称:mmorpg-xfw,代码行数:25,代码来源:MapPane.cpp
示例3: sendNextUnit
bool UnitSync::sendNextUnit(PlayerID toplayer)
{
UnitBase* unit;
do {
unit = iter.next();
if(unit == 0) {
playerid++;
if(playerid >= PlayerInterface::getMaxPlayers())
return false;
unitlist = UnitInterface::getUnitList(playerid);
iter = unitlist->getAsyncIterator();
}
} while(unit == 0);
iXY unit_map_loc;
MapInterface::pointXYtoMapXY(unit->unit_state.location, &unit_map_loc);
UnitIniSyncMessage sync_message;
sync_message.unit_type = unit->unit_state.unit_type;
sync_message.unit_id = unit->unit_id;
sync_message.location_x = unit_map_loc.x;
sync_message.location_y = unit_map_loc.y;
sync_message.unit_state = unit->unit_state.getNetworkUnitState();
SERVER->sendMessage(toplayer, &sync_message, sizeof(UnitIniSyncMessage), 0);
unit->syncUnit();
return true;
}
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:30,代码来源:UnitSync.cpp
示例4: getUnit
void UnitInterface::selfDestructUnit(const UnitID unit_id)
{
UnitBase * unit = getUnit(unit_id);
if ( unit )
{
unit->selfDestruct();
}
}
开发者ID:LucasVini,项目名称:OldNetPanzer,代码行数:8,代码来源:UnitInterface.cpp
示例5: destroyPlayerUnits
void UnitInterface::destroyPlayerUnits(PlayerID player_id)
{
PlayerUnitList& unitlist = playerUnitLists[player_id];
for(PlayerUnitList::iterator i = unitlist.begin();
i != unitlist.end(); ++i)
{
UnitBase* unit = *i;
unit->selfDestruct();
}
}
开发者ID:LucasVini,项目名称:OldNetPanzer,代码行数:10,代码来源:UnitInterface.cpp
示例6: getUndergroundUnit
void Tile::blitUndergroundUnits(int xPos, int yPos) {
if(hasAnUndergroundUnit() && !isFogged(pLocalHouse->getHouseID())) {
UnitBase* current = getUndergroundUnit();
if(current->isVisible(pLocalHouse->getTeam())) {
if(location == current->getLocation()) {
current->blitToScreen();
}
}
}
}
开发者ID:binarycrusader,项目名称:dunelegacy,代码行数:11,代码来源:Tile.cpp
示例7: destroyPlayerUnits
void UnitInterface::destroyPlayerUnits(PlayerID player_id)
{
UMesgSelfDestruct self_destruct;
self_destruct.setHeader(0, _umesg_flag_unique);
PlayerUnitList& unitlist = playerUnitLists[player_id];
for(PlayerUnitList::iterator i = unitlist.begin();
i != unitlist.end(); ++i) {
UnitBase* unit = *i;
unit->processMessage(&self_destruct);
}
}
开发者ID:Rominagrobis,项目名称:OldNetPanzer,代码行数:12,代码来源:UnitInterface.cpp
示例8: weaponHit
void UnitInterface::weaponHit( const UnitID from_unit,
const iXY& location,
const Uint16 damage_factor)
{
for(Units::iterator i = units.begin(); i != units.end(); ++i)
{
UnitBase* unit = i->second;
if ( unit->unit_state.bounds(location) )
{
if ( unit->weaponHit( from_unit, damage_factor) )
{
unitKilled(unit, from_unit);
}
}
}
}
开发者ID:LucasVini,项目名称:OldNetPanzer,代码行数:16,代码来源:UnitInterface.cpp
示例9: while
void UnitInterface::unitOpcodeMessage(const NetMessage *net_message, size_t size)
{
UnitOpcodeDecoder decoder;
decoder.setMessage(net_message, size);
UnitOpcode* opcode;
while(decoder.decode(&opcode)) {
UnitBase* unit = getUnit(opcode->getUnitID());
if(!unit) {
LOGGER.debug("Update for non-existant unit: %d",
opcode->getUnitID());
continue;
}
unit->evalCommandOpcode(opcode);
}
}
开发者ID:Rominagrobis,项目名称:OldNetPanzer,代码行数:18,代码来源:UnitInterface.cpp
示例10: updateUnitStatus
void UnitInterface::updateUnitStatus()
{
for(Units::iterator i = units.begin(); i != units.end(); /*nothing*/ ) {
UnitBase* unit = i->second;
if (unit->unit_state.lifecycle_state == _UNIT_LIFECYCLE_INACTIVE) {
Units::iterator next = i;
++next;
removeUnit(i);
i = next;
continue;
}
unsigned long pre_update_bucket_index;
unsigned long post_update_bucket_index;
pre_update_bucket_index
= unit_bucket_array.worldLocToBucketIndex(
unit->unit_state.location );
unit->updateState();
post_update_bucket_index
= unit_bucket_array.worldLocToBucketIndex(
unit->unit_state.location );
if ( post_update_bucket_index != pre_update_bucket_index ) {
unit_bucket_array.moveUnit(unit->id,
pre_update_bucket_index, post_update_bucket_index );
}
++i;
}
if ( NetworkState::status == _network_state_server ) {
if (message_timer.count()) {
opcode_encoder.send();
}
}
}
开发者ID:Rominagrobis,项目名称:OldNetPanzer,代码行数:38,代码来源:UnitInterface.cpp
示例11: getUnit
void
UnitInterface::sendMessage(const UnitMessage* message,const PlayerState* player)
{
if (message->isFlagged(_umesg_flag_unique)) {
UnitBase* unit = getUnit(message->getUnitID());
if(unit == 0)
return;
if(player && unit->player != player) {
LOGGER.warning(
"Terminal request for unit (%u) not owned by player (%u).\n",
unit->id, player->getID());
return;
}
unit->processMessage(message);
} else if (message->isFlagged( _umesg_flag_broadcast) ) {
if(message->message_id != _umesg_weapon_hit) {
LOGGER.warning("Broadcast flag only allowed for weapon hit.");
if(player) {
LOGGER.warning("from player %u.\n", player->getID());
}
return;
}
for(Units::iterator i = units.begin(); i != units.end(); ++i) {
UnitBase* unit = i->second;
unit->processMessage(message);
}
} else if (message->isFlagged( _umesg_flag_manager_request) ) {
if(player) {
LOGGER.warning(
"UnitManagerMessage sent out by player %u not allowed.",
player->getID());
return;
}
processManagerMessage(message);
}
}
开发者ID:Rominagrobis,项目名称:OldNetPanzer,代码行数:38,代码来源:UnitInterface.cpp
示例12: if
void Player::skill_used( int skid, S_INT_64 targetid, CHRSTATE_TYPE_ENUM st)
{
USE_PROTOCOL_NAMESPACE;
S_INT_8 ret =0;
//1.检查当前状态
if( cur_state_->get_statetype() != st)
{
if( action_selector_.goto_state( st) == 0)
ret =4;
}
//2.检查技能是否合法
SkillRuntime* sr =0;
SkillDesc* pdesc =0;
if( ret == 0)
{
sr =myskills_.get_skillruntime( skid);
//技能是否可用
if( sr == 0)
ret =1;
else
{
pdesc =sr->get_skilldesc();
if( !pdesc->driving_)
{
//是否是主动技能
ret =6;
}
else if( !cur_state_->is_skillinstate( skid))
{
//技能是否存在于当前状态的技能列表中
ret =5;
}
else
{
//检查cooldown时间
if( !sr->is_cooldown())
ret =2;
}
}
}
//3.检查目标是否有效
if( ret == 0 && pdesc->singleattack_)
{
if( this->fight_target_obj_ == 0 || fight_target_obj_->get_uuid() != targetid)
{
UnitBase* pTarget =CONTENTSERVICE_INS->get_onlineentity( targetid);
if( pTarget == 0 || pTarget == this)
{
ret =3;
}
else
{
//目标是否能被攻击
if( !pTarget->can_beattacked( this))
{
ret =3;
}
else
{
//设置战斗对象
this->set_fighttargetobj( pTarget);
}
}
}
}
//4.执行脚本
if( ret == 0)
{
app::script::ScriptContext& context =CONTENTSERVICE_INS->get_scriptcontext();
try{
ret =luabind::call_function<char>( context.get_luastate(), "skill_use", pdesc->skillidsn_.c_str(), this, sr->get_runtimedata());
}
catch( ...){
lua_pop( context.get_luastate(), 1);
ret =-1;
}
}
if( ret == 0)
{
//是否是瞬发技能
if( !sr->is_immediate())
myskills_.set_curskill( sr);
//设置最后执行时间
sr->update_lastruntime();
//通知其他人触发技能
}
Pro_SkillUsed_ack* ack =PROTOCOL_NEW Pro_SkillUsed_ack();
PRO_UUID_FILL( ack, this->global_index_, this->uuid_);
ack->skillid_ =skid;
ack->curstate_ =cur_state_->get_statetype();
ack->target_unit_ =( fight_target_obj_?fight_target_obj_->get_uuid():NO_INITVALUE);
ack->ret_ =ret;
//.........这里部分代码省略.........
开发者ID:roseboych,项目名称:mmorpg-xfw,代码行数:101,代码来源:Player_Skill.cpp
示例13: setType
void Tile::triggerSpecialBloom(House* pTrigger) {
if(isSpecialBloom()) {
setType(Terrain_Sand);
switch(currentGame->randomGen.rand(0,3)) {
case 0: {
// the player gets an randomly choosen amount of credits between 150 and 400
pTrigger->addCredits(currentGame->randomGen.rand(150, 400),false);
}
break;
case 1: {
// The house gets a Trike for free. It spawns beside the special bloom.
UnitBase* pNewUnit = pTrigger->createUnit(Unit_Trike);
if(pNewUnit != NULL) {
Coord spot = currentGameMap->findDeploySpot(pNewUnit, location);
pNewUnit->deploy(spot);
}
}
break;
case 2: {
// One of the AI players on the map (one that has at least one unit) gets a Trike for free. It spawns beside the special bloom.
int numCandidates = 0;
for(int i=0; i<NUM_HOUSES; i++) {
House* pHouse = currentGame->getHouse(i);
if(pHouse != NULL && pHouse->getTeam() != pTrigger->getTeam() && pHouse->getNumUnits() > 0) {
numCandidates++;
}
}
if(numCandidates == 0) {
break;
}
House* pEnemyHouse = NULL;
for(int i=0; i<NUM_HOUSES; i++) {
House* pHouse = currentGame->getHouse(i);
if(pHouse != NULL && pHouse->getTeam() != pTrigger->getTeam() && pHouse->getNumUnits() > 0) {
numCandidates--;
if(numCandidates == 0) {
pEnemyHouse = pHouse;
break;
}
}
}
UnitBase* pNewUnit = pEnemyHouse->createUnit(Unit_Trike);
if(pNewUnit != NULL) {
Coord spot = currentGameMap->findDeploySpot(pNewUnit, location);
pNewUnit->deploy(spot);
}
}
break;
case 3:
default: {
// One of the AI players on the map (one that has at least one unit) gets an Infantry unit (3 Soldiers) for free. The spawn beside the special bloom.
int numCandidates = 0;
for(int i=0; i<NUM_HOUSES; i++) {
House* pHouse = currentGame->getHouse(i);
if(pHouse != NULL && pHouse->getTeam() != pTrigger->getTeam() && pHouse->getNumUnits() > 0) {
numCandidates++;
}
}
if(numCandidates == 0) {
break;
}
House* pEnemyHouse = NULL;
for(int i=0; i<NUM_HOUSES; i++) {
House* pHouse = currentGame->getHouse(i);
if(pHouse != NULL && pHouse->getTeam() != pTrigger->getTeam() && pHouse->getNumUnits() > 0) {
numCandidates--;
if(numCandidates == 0) {
pEnemyHouse = pHouse;
break;
}
}
}
for(int i=0; i<3; i++) {
UnitBase* pNewUnit = pEnemyHouse->createUnit(Unit_Soldier);
if(pNewUnit != NULL) {
Coord spot = currentGameMap->findDeploySpot(pNewUnit, location);
pNewUnit->deploy(spot);
}
}
}
break;
}
}
}
开发者ID:binarycrusader,项目名称:dunelegacy,代码行数:95,代码来源:Tile.cpp
示例14: sendManualFireCommand
//.........这里部分代码省略.........
box_press = world_pos;
box_release = world_pos;
}else{
}
}
} // ** _event_mbutton_down
if ( event.event == MouseEvent::EVENT_UP ) {
if (outpost_goal_selection != -1 ){
iXY temp;
MouseInterface::getMousePosition( &temp.x, &temp.y );
WorldViewInterface::clientXYtoWorldXY( world_win, temp, &world_pos );
Objective *objective;
PlayerID player_id = PlayerInterface::getLocalPlayerID();
int cs = ObjectiveInterface::quearyObjectiveLocationStatus( world_pos, player_id, &objective );
if ( (cs == _player_occupied_objective_found)
&& outpost_goal_selection == objective->objective_state.ID
) {
// we've let go of the mouse on the building so we're
// not changing the spawn point
selected_objective_id = CURRENT_SELECTED_OUTPOST_ID = objective->objective_state.ID;
activateVehicleSelectionView( selected_objective_id );
}
else {
TerminalOutpostOutputLocRequest term_mesg;
term_mesg.output_loc_request.set( outpost_goal_selection,
world_pos);
CLIENT->sendMessage( &term_mesg, sizeof(TerminalOutpostOutputLocRequest), 0 );
if ( NetworkState::status == _network_state_client ) {
ObjectiveInterface::sendMessage( &(term_mesg.output_loc_request) );
}
}
outpost_goal_selection = -1;
}
}
if ( (event.event == MouseEvent::EVENT_CLICK) &&
(left_button_hold_action_complete == false) ) {
WorldViewInterface::clientXYtoWorldXY( world_win, event.down_pos, &world_pos );
click_status = getCursorStatus( world_pos );
switch ( click_status ) {
case _cursor_player_unit : {
if( (KeyboardInterface::getKeyState( SDLK_LSHIFT ) == true) ||
(KeyboardInterface::getKeyState( SDLK_RSHIFT ) == true)
) {
working_list.addUnit( world_pos );
} else {
working_list.selectUnit( world_pos );
}
current_selection_list_bits=0;
current_selection_list_index = 0xFFFF;
if (working_list.unit_list.size() > 0) {
UnitBase *unit = UnitInterface::getUnit(working_list.unit_list[0]);
unit->soundSelected();
}
}
break;
case _cursor_move:
case _cursor_blocked: {
if(outpost_goal_selection == -1){
sendMoveCommand( world_pos );
}
}
break;
case _cursor_enemy_unit : {
sendAttackCommand( world_pos );
}
break;
case _cursor_make_allie : {
sendAllianceRequest( world_pos, true );
}
break;
case _cursor_break_allie : {
sendAllianceRequest( world_pos, false );
}
break;
} // ** switch
} // ** if _event_mbutton_click
} // ** else manual_control_state == false;
} // ** evalLeftMButtonEvents
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:101,代码来源:WorldInputCmdProcessor.cpp
示例15: switch
void Command::executeCommand() const {
switch(commandID) {
case CMD_PLACE_STRUCTURE: {
if(parameter.size() != 3) {
throw std::invalid_argument("Command::executeCommand(): CMD_PLACE_STRUCTURE needs 3 Parameters!");
}
ConstructionYard* pConstYard = dynamic_cast<ConstructionYard*>(currentGame->getObjectManager().getObject(parameter[0]));
if(pConstYard == NULL) {
return;
}
pConstYard->doPlaceStructure((int) parameter[1], (int) parameter[2]);
} break;
case CMD_UNIT_MOVE2POS: {
if(parameter.size() != 4) {
throw std::invalid_argument("Command::executeCommand(): CMD_UNIT_MOVE2POS needs 4 Parameters!");
}
UnitBase* unit = dynamic_cast<UnitBase*>(currentGame->getObjectManager().getObject(parameter[0]));
if(unit == NULL) {
return;
}
unit->doMove2Pos((int) parameter[1], (int) parameter[2], (bool) parameter[3]);
} break;
case CMD_UNIT_MOVE2OBJECT: {
if(parameter.size() != 2) {
throw std::invalid_argument("Command::executeCommand(): CMD_UNIT_MOVE2OBJECT needs 2 Parameters!");
}
UnitBase* unit = dynamic_cast<UnitBase*>(currentGame->getObjectManager().getObject(parameter[0]));
if(unit == NULL) {
return;
}
unit->doMove2Object((int) parameter[1]);
} break;
case CMD_UNIT_ATTACKPOS: {
if(parameter.size() != 4) {
throw std::invalid_argument("Command::executeCommand(): CMD_UNIT_ATTACKPOS needs 4 Parameters!");
}
UnitBase* unit = dynamic_cast<UnitBase*>(currentGame->getObjectManager().getObject(parameter[0]));
if(unit == NULL) {
return;
}
unit->doAttackPos((int) parameter[1], (int) parameter[2], (bool) parameter[3]);
} break;
case CMD_UNIT_ATTACKOBJECT: {
if(parameter.size() != 2) {
throw std::invalid_argument("Command::executeCommand(): CMD_UNIT_ATTACKOBJECT needs 2 Parameters!");
}
UnitBase* pUnit = dynamic_cast<UnitBase*>(currentGame->getObjectManager().getObject(parameter[0]));
if(pUnit == NULL) {
return;
}
pUnit->doAttackObject((int) parameter[1], true);
} break;
case CMD_INFANTRY_CAPTURE: {
if(parameter.size() != 2) {
throw std::invalid_argument("Command::executeCommand(): CMD_INFANTRY_CAPTURE needs 2 Parameters!");
}
InfantryBase* pInfantry = dynamic_cast<InfantryBase*>(currentGame->getObjectManager().getObject(parameter[0]));
if(pInfantry == NULL) {
return;
}
pInfantry->doCaptureStructure((int) parameter[1]);
} break;
case CMD_UNIT_SETMODE: {
if(parameter.size() != 2) {
throw std::invalid_argument("Command::executeCommand(): CMD_UNIT_SETMODE needs 2 Parameter!");
}
UnitBase* pUnit = dynamic_cast<UnitBase*>(currentGame->getObjectManager().getObject(parameter[0]));
if(pUnit == NULL) {
return;
}
pUnit->doSetAttackMode((ATTACKMODE) parameter[1]);
} break;
case CMD_DEVASTATOR_STARTDEVASTATE: {
if(parameter.size() != 1) {
throw std::invalid_argument("Command::executeCommand(): CMD_DEVASTATOR_STARTDEVASTATE needs 1 Parameter!");
}
Devastator* pDevastator = dynamic_cast<Devastator*>(currentGame->getObjectManager().getObject(parameter[0]));
if(pDevastator == NULL) {
return;
}
pDevastator->doStartDevastate();
} break;
case CMD_MCV_DEPLOY: {
if(parameter.size() != 1) {
throw std::invalid_argument("Command::executeCommand(): CMD_MCV_DEPLOY needs 1 Parameter!");
}
MCV* pMCV = dynamic_cast<MCV*>(currentGame->getObjectManager().getObject(parameter[0]));
if(pMCV == NULL) {
return;
}
//.........这里部分代码省略.........
开发者ID:binarycrusader,项目名称:dunelegacy,代码行数:101,代码来源:Command.cpp
示例16: sendManualFireCommand
//.........这里部分代码省略.........
if ( (cs == _player_occupied_objective_found)
&& outpost_goal_selection == objective->objective_state.ID
)
{
// we've let go of the mouse on the building so we're
// not changing the spawn point
selected_objective_id = objective->objective_state.ID;
activateVehicleSelectionView( selected_objective_id );
}
else
{
TerminalOutpostOutputLocRequest term_mesg;
term_mesg.output_loc_request.set( outpost_goal_selection,
world_pos);
CLIENT->sendMessage(&term_mesg, sizeof(TerminalOutpostOutputLocRequest));
if ( NetworkState::status == _network_state_client )
{
ObjectiveInterface::sendMessage( &(term_mesg.output_loc_request) );
}
}
outpost_goal_selection = OBJECTIVE_NONE;
return;
}
click_status = getCursorStatus(world_pos);
switch(click_status)
{
case _cursor_player_unit:
{
static NTimer dclick_timer(200);
static int click_times = 0;
bool addunits = false;
if( (KeyboardInterface::getKeyState(SDLK_LSHIFT) == true) ||
(KeyboardInterface::getKeyState(SDLK_RSHIFT) == true))
{
addunits = true;
}
if ( ! dclick_timer.isTimeOut() )
{
if ( click_times )
{
iRect wr;
WorldViewInterface::getViewWindow(&wr);
working_list.selectBounded(wr, addunits);
click_times=0;
}
else
{
working_list.selectSameTypeVisible(world_pos,addunits);
dclick_timer.reset();
click_times++;
}
break;
}
else if (addunits)
{
working_list.addUnit(world_pos);
}
else
{
working_list.selectUnit(world_pos );
}
current_selection_list_bits=0;
current_selection_list_index = 0xFFFF;
if (working_list.unit_list.size() > 0)
{
UnitBase *unit = UnitInterface::getUnit(
working_list.unit_list[0]);
if(unit)
unit->soundSelected();
}
dclick_timer.reset();
click_times=0;
break;
}
case _cursor_move:
case _cursor_blocked:
if(outpost_goal_selection == OBJECTIVE_NONE)
sendMoveCommand(world_pos);
break;
case _cursor_enemy_unit:
sendAttackCommand(world_pos);
break;
case _cursor_make_allie:
sendAllianceRequest(world_pos, true);
break;
case _cursor_break_allie:
sendAllianceRequest(world_pos, false);
break;
}
}
}
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:101,代码来源:WorldInputCmdProcessor.cpp
示例17: removeUnit
void Team::removeUnit( const UnitBase& unit )
{
if ( &unit.getTeam() != this )
throw UnitDoesNotBelongException();
//m_units.erase( std::find( m_units.begin(), m_units.end(), std::cref( unit ) ) );
}
开发者ID:robertdhernandez,项目名称:custom-war,代码行数:6,代码来源:team.cpp
示例18: Update
void StageDig::Update(void)
{
// モグルのドリルで敵にダメージ
UnitManager &unitManager = UnitManager::GetInstance();
VECTOR position;
position.x = 7.5f;
position.y = 5.0f;
UnitBase* unit = unitManager.GetNearUnit( position, 1.0f, true );
if( unit != NULL )
{
VECTOR damageType;
unit->AddDamage(1000, UnitBase::DAMAGETYPE_NORMAL, damageType, NULL );
}
// ブロック削り判定
BlockManager &blockManager = BlockManager::GetInstance();
BlockBase* base = blockManager.GetBlock( position.x, position.y );
// 指定地点が空なら
if( base == NULL || base->m_ID == BLOCK_WATER || base->m_ID == BLOCK_FIRE)
{
float speed = 0.06f;
if( base )
{
if(base->m_ID == BLOCK_WATER )
{
speed = 0.03f;
}
else if( base->m_ID == BLOCK_FIRE && GameInput::GetInstance().GetFrame() % 10 == 0)
{
DataManager::GetInstance().m_MogllStatus.life -= EquipmentFunction_05(1);
}
}
float fallValue = EquipmentFunction_40( speed );
blockManager.AddDepth( fallValue );
DataManager &data = DataManager::GetInstance();
// 記録更新したら代入
int depth = static_cast<int>(blockManager.GetDepth() + data.m_MogllStatus.position.y * 600.0f / 40.0f);
if( data.m_SaveData.stageDepth[ data.m_SceneInt["StageNo"] ] < depth )
{
data.m_SaveData.stageDepth[ data.m_SceneInt["StageNo"] ] = depth;
}
//UnitManager::GetInstance().MoveUp( fallValue );
}
else if( EquipmentFunction_35( GameInput::GetInstance().GetFrame() ) )
{
DataManager &data = DataManager::GetInstance();
// ブロックの削りダメージ
int damage = 1;
int mogllDamage = EquipmentFunction_11( data.m_SystemData.block[ base->m_ID - 1 ].damage );
m_DigPoint += mogllDamage;
if( m_DigPoint >= 100 )
{
data.m_MogllStatus.life -= m_DigPoint / 100;
m_DigPoint = m_DigPoint % 100;
}
base->m_Life -= damage;
}
//-------------------------------------------------------------- 笹井
//今いるブロックをチェック
base = blockManager.GetBlock( position.x, position.y );
if(base)
{
if(base->m_ID == BLOCK_WATER )
{
m_SEWaterCnt--;
if( m_SEWaterCnt <= 0 &&
CheckSoundMem(DataManager::GetInstance().Get( DataManager::SoundSE57 )) == 0)
{
PlaySoundMem( DataManager::GetInstance().Get( DataManager::SoundSE57 ), DX_PLAYTYPE_BACK);
m_SEWaterCnt = 90;
}
}
else if( base->m_ID == BLOCK_FIRE)
{
if(CheckSoundMem(DataManager::GetInstance().Get( DataManager::SoundSE56 )) == 0)
PlaySoundMem( DataManager::GetInstance().Get( DataManager::SoundSE56 ), DX_PLAYTYPE_BACK);
}
if(base->m_ID != BLOCK_WATER )
m_SEWaterCnt = 0;
}
}
开发者ID:rurudo,项目名称:moguru,代码行数:80,代码来源:StageDig.cpp
注:本文中的UnitBase类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论