MessagePacket::MessagePacket(const dtGame::Message& message) : GNE::Packet(MessagePacket::ID) , mDestination("") , mSource(message.GetSource().GetUniqueId()) , mSendingActor(message.GetSendingActorId()) , mAboutActor(message.GetAboutActorId()) { BuildFromMessage(message); }
void MessagePacket::BuildFromMessage(const dtGame::Message& message) { // Get the Id from the message mMessageId = message.GetMessageType().GetId(); // If the message has a destination, encapsulate if (message.GetDestination() != NULL) { mDestination = message.GetDestination()->GetUniqueId(); } // encapsulate source mSource = message.GetSource().GetUniqueId(); // encapsulate actor Id's mSendingActor = message.GetSendingActorId(); mAboutActor = message.GetAboutActorId(); // Get the MessageParameters from the message message.ToString(mMessageParameters); }
void FireActor::PlayFireSound(const dtGame::Message& msg) { // Check to see if the actor is the door to the fire room dtGame::GameActorProxy* proxy = GetGameActorProxy().GetGameManager()->FindGameActorById(msg.GetAboutActorId()); if (proxy == NULL) { return; } HatchActor* ha = dynamic_cast<HatchActor*>(proxy->GetActor()); if (ha == NULL) { return; } // Hatch item was activated/deactivated, play/stop the sound ha->IsActivated() ? mItemUseSnd->Play() : mItemUseSnd->Stop(); }