コード例 #1
0
ファイル: testaarhud.cpp プロジェクト: VRAC-WATCH/deltajug
void TestAARHUD::ProcessMessage(const dtGame::Message& message)
{
   if (message.GetMessageType() == dtGame::MessageType::TICK_LOCAL)
   {
      TickHUD();
   }
   else if (message.GetMessageType() == dtGame::MessageType::INFO_MAP_LOADED)
   {
      GetGameManager()->GetScene().AddDrawable(GetGUIDrawable());
   }
}
コード例 #2
0
void KillableTargetActor::ProcessMessage(const dtGame::Message& message)
{
   // HANDLE GAME EVENT MESSAGE - "TankFired"
   if (message.GetMessageType() == dtGame::MessageType::INFO_GAME_EVENT)
   {
      const dtGame::GameEventMessage& eventMsg =
         static_cast<const dtGame::GameEventMessage&>(message);

      // Note, we are using strings which aren't constants.  In a real application, these
      // event names should be stored in some sort of shared place and should be constants...
      if (eventMsg.GetGameEvent() != 0 && eventMsg.GetGameEvent()->GetName() == "TankFired")
      {
         if (mIsTargeted && mCurrentHealth > 0)
         {
            SetCurrentHealth(GetCurrentHealth() - 25);
         }
      }
      // test our shaders
      else if (eventMsg.GetGameEvent() != 0 && eventMsg.GetGameEvent()->GetName() == "TestShaders")
      {
         // Note, this behavior is now done in the InputComponent.cpp using the new Shader method.
         //dtCore::ShaderManager::GetInstance().Clear();
         //dtCore::ShaderManager::GetInstance().LoadShaderDefinitions("Shaders/TutorialShaderDefs.xml", false);
         //ApplyMyShader();
      }
      // reset me!
      else if (eventMsg.GetGameEvent() != 0 && eventMsg.GetGameEvent()->GetName() == "ResetStuff")
      {
         SetTransform(mOriginalPosition);
         ResetState();
      }
   }
   // HANDLE TARGET CHANGED MESSAGE
   else if (message.GetMessageType() == TutorialMessageType::TANK_TARGET_CHANGED)
   {
      const TargetChangedMessage& targetChanged = static_cast<const TargetChangedMessage&>(message);
      mIsTargeted = (targetChanged.GetNewTargetUniqueId() ==  GetUniqueId());

      if (mIsTargeted && mCurrentHealth > 0)
      {
         // Ahhhh! Get that gun outta my face!
         mCurrentShaderName = "Green";
      }
      else
      {
         //mCurrentShaderName = "Green";
         mCurrentShaderName = "Normal";
      }

      ApplyMyShader();
   }

}
コード例 #3
0
ファイル: oceanactor.cpp プロジェクト: energonQuest/dtOcean
void OceanActor::ProcessMessage(const dtGame::Message& msg)
{
   if (msg.GetMessageType() == dtGame::MessageType::INFO_MAP_LOADED)
   {
      OnMapLoaded();
   }
}
コード例 #4
0
ファイル: messagepacket.cpp プロジェクト: VRAC-WATCH/deltajug
   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);
   }