本文整理汇总了C++中Missile::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ Missile::Release方法的具体用法?C++ Missile::Release怎么用?C++ Missile::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Missile
的用法示例。
在下文中一共展示了Missile::Release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Step
void Client::Step()
{
ENetEvent event;
while(enet_host_service(_host, &event, 1) > 0)
{
switch(event.type)
{
case ENET_EVENT_TYPE_RECEIVE:
{
Packet packet(event.packet->data, event.packet->dataLength);
enet_packet_destroy(event.packet);
switch(packet.GetType())
{
case Packet::Type::Handshake:
_clientID = packet.ReadUInt32();
RNDebug("Received handshake. I'm client %d", _clientID);
break;
case Packet::Type::ClientConnected:
{
uint32 client = packet.ReadUInt32();
if(client != _clientID)
{
RNDebug("Another client, %d, connected", client);
World::GetSharedInstance()->GetEnemyWithID(client);
}
break;
}
case Packet::Type::ClientDisconnected:
{
uint32 client = packet.ReadUInt32();
if(client != _clientID)
{
RNDebug("Client %d disconnected", client);
World::GetSharedInstance()->RemoveEnemy(client);
}
break;
}
case Packet::Type::PositionUpdate:
{
uint32 client = packet.ReadUInt32();
if(client != _clientID)
{
Enemy *enemy = World::GetSharedInstance()->GetEnemyWithID(client);
enemy->UpdateFromPacket(packet);
}
break;
}
case Packet::Type::ShotsFired:
{
uint32 client = packet.ReadUInt32();
if(client != _clientID)
{
Missile *missile = new Missile(client, packet);
missile->Release();
}
break;
}
case Packet::Type::GoodHit:
{
uint32 client = packet.ReadUInt32();
uint32 shooter = packet.ReadUInt32();
RN::Vector3 position(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
if(client == _clientID)
SpaceShip::GetLocalShip()->TakeHit(position, shooter);
Explosion *explosion = new Explosion();
explosion->SetPosition(position);
explosion->Autorelease();
break;
}
case Packet::Type::GoodKill:
{
uint32 client = packet.ReadUInt32();
uint32 killer = packet.ReadUInt32();
RNDebug("Good kill on %d by %d", client, killer);
if(killer == _clientID)
World::GetSharedInstance()->TallyKill();
RN::Vector3 position(packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat());
//.........这里部分代码省略.........