本文整理汇总了C++中Opt::SetX方法的典型用法代码示例。如果您正苦于以下问题:C++ Opt::SetX方法的具体用法?C++ Opt::SetX怎么用?C++ Opt::SetX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opt
的用法示例。
在下文中一共展示了Opt::SetX方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnStartGameMode
void FreeForAllGameModeSystem::OnStartGameMode( core::StartGameModeEvent const& Evt )
{
if ( Evt.mMode != "ffa" )
{
return;
}
::engine::Engine::Get().SetEnabled< ::engine::SoldierSpawnSystem>( true );
::engine::Engine::Get().SetEnabled< ::engine::ctf::CtfSoldierSpawnSystem>( false );
::engine::Engine::Get().SetEnabled< ::map::EditorSoldierSpawnSystem>( false );
::engine::Engine::Get().SetEnabled< ::map::RoomEditorSystem>( false );
::engine::Engine::Get().SetEnabled< ::map::EditorSystem>( false );
::engine::Engine::Get().SetEnabled< ::map::EditorTargetSystem>( false );
::engine::Engine::Get().SetEnabled< ::map::EditorGridSystem>( false );
::engine::Engine::Get().SetEnabled< ::map::EditorBrushSystem>( false );
::engine::Engine::Get().SetEnabled< ::core::FreeForAllGameModeSystem>( true );
::engine::Engine::Get().SetEnabled< ::core::CaptureTheFlagGameModeSystem>( false );
::engine::Engine::Get().SetEnabled< ::core::RogueGameModeSystem>( false );
auto levelSelectionSystem = engine::Engine::Get().GetSystem<LevelSelectionSystem>();
if ( levelSelectionSystem.IsValid() )
{
mScene.Load( levelSelectionSystem->GetSelectedLevel() );
}
else
{
L1("failed to retrieve LevelSelectionSystem\n");
return;
}
// glfwSetInputMode(engine::Engine::Get().GetSystem<engine::WindowSystem>()->GetWindow(),GLFW_CURSOR,GLFW_CURSOR_HIDDEN);
Ui::Get().Load( "hud" );
if ( ProgramState::Get().mMode == ProgramState::Client )
{
return;
}
if ( ProgramState::Get().mMode != ProgramState::Local )
{
return;
}
std::auto_ptr<Actor> Pl;
for( int i = 0; i < 11; ++i )
{
Pl = ActorFactory::Get()( AutoId( "player" ) );
Opt<IPositionComponent> positionC = Pl->Get<IPositionComponent>();
positionC->SetX( -240 + i * 60 );
positionC->SetY( 0.0 );
Pl->Get<IInventoryComponent>();
Opt<IInventoryComponent> inventoryC = Pl->Get<IInventoryComponent>();
inventoryC->AddItem( AutoId( "plasma_gun" ) );
inventoryC->SetSelectedWeapon( AutoId( "plasma_gun" ) );
Opt<PlayerControllerComponent> pcc( Pl->Get<IControllerComponent>() );
pcc->SetEnabled( false );
pcc->mActive = false;
pcc->mControllerId = i;
Pl->Get<IMoveComponent>()->SetMoving( false );
mScene.AddActor( Pl.release() );
}
}
示例2: PlaceLevelEndPoint
void IRoom::PlaceLevelEndPoint( RoomDesc &roomDesc, glm::vec2 pos )
{
auto endPoint = ActorFactory::Get()( AutoId( "platform" ) );
Opt<IPositionComponent> positionC = endPoint->Get<IPositionComponent>();
positionC->SetX( pos.x );
positionC->SetY( pos.y );
mScene.AddActor( endPoint.release() );
}
示例3: clientActor
std::auto_ptr<Actor> SoldierSpawnSystem::Spawn( core::ClientData& clientData, map::SpawnPoint spawnPoint, std::auto_ptr<Actor> player )
{
Opt<Actor> clientActor( mScene.GetActor( clientData.mClientActorGUID ) );
if( clientActor.IsValid() )
{
Opt<IHealthComponent> healthC = clientActor->Get<IHealthComponent>();
if ( healthC.IsValid() && healthC->IsAlive() )
{
L1( "Cannot spawn soldier for clientData (%s) current soldier still alive!\n", clientData.mClientName.c_str() );
return std::auto_ptr<Actor>();
}
}
else
{
L2( "No actor for clientData(%s). (it might be an error on revive)\n", clientData.mClientName.c_str() );
}
L2( "player is valid %d", player.get() );
Opt<IPositionComponent> positionC = player->Get<IPositionComponent>();
L2( "positionC is valid %d", positionC.IsValid() );
positionC->SetX( spawnPoint.mX );
positionC->SetY( spawnPoint.mY );
//TODO: temporary till normal inventory sync
// Opt<IInventoryComponent> inventoryC = player->Get<IInventoryComponent>();
// if ( inventoryC.IsValid() )
// {
// inventoryC->SetSelectedWeapon( AutoId( "pistol" ) );
// }
Opt<PlayerControllerComponent> playerControllerC( player->Get<IControllerComponent>() );
if ( playerControllerC.IsValid() )
{
playerControllerC->mControllerId = clientData.mClientId;
if ( mProgramState.mControlledActorGUID == clientData.mClientActorGUID
&& mProgramState.mMode != core::ProgramState::Server )
{
playerControllerC->SetEnabled( true );
playerControllerC->mActive = true;
mProgramState.mControlledActorGUID = player->GetGUID();
}
}
clientData.mClientActorGUID = player->GetGUID(); //TODO: might seek for a better place
L2( "player created clientId:%d clientName:%s actorId:%d\n", clientData.mClientId, clientData.mClientName.c_str(), clientData.mClientActorGUID );
if ( mProgramState.mMode != core::ProgramState::Server &&
mProgramState.mClientDatas.begin()->mClientActorGUID == player->GetGUID() )
{
Scene::Get().SetPlayerModels( Opt<Actor>( player.get() ) );
}
EventServer<SoldierCreatedEvent>::Get().SendEvent( SoldierCreatedEvent( clientData, Opt<Actor>( player.get() ) ) );
return player;
}
示例4: Execute
void FlashMessageHandlerSubSystem::Execute( Message const& message )
{
FlashMessage const& msg = static_cast<FlashMessage const&>( message );
Opt<Actor> actor = mScene.GetActor( msg.mActorGUID );
if ( !actor.IsValid() )
{
L1( "cannot find actor with GUID: (%s) %d \n", __FUNCTION__, msg.mActorGUID );
return;
}
Opt<IPositionComponent> positionC = actor->Get<IPositionComponent>();
if ( !positionC.IsValid() )
{
return;
}
positionC->SetX( msg.mX / PRECISION );
positionC->SetY( msg.mY / PRECISION );
}
示例5: SetProjectilePosition
void WeaponItemSubSystem::SetProjectilePosition(Actor& projectile, Actor& actor)
{
Opt<IPositionComponent> projPositionC = projectile.Get<IPositionComponent>();
Opt<IPositionComponent> actorPositionC = actor.Get<IPositionComponent>();
glm::vec2 rvec(0.0, 0.0);
Opt<IInventoryComponent> inventoryC = actor.Get<IInventoryComponent>();
if (inventoryC.IsValid())
{
Opt<Weapon> weapon = inventoryC->GetSelectedWeapon();
if (weapon.IsValid())
{
rvec.x += weapon->GetPositionX();
rvec.y -= weapon->GetPositionY();
}
}
rvec=glm::rotate(rvec, float(actorPositionC->GetOrientation()));
projPositionC->SetX( projPositionC->GetX() + actorPositionC->GetX() + rvec.x );
projPositionC->SetY( projPositionC->GetY() + actorPositionC->GetY() + rvec.y );
}