コード例 #1
0
ファイル: aiPlayer.cpp プロジェクト: elfprince13/Torque3D
bool AIPlayer::setPathDestination(const Point3F &pos)
{
   // Pathfinding only happens on the server.
   if(!isServerObject())
      return false;

   if(!getNavMesh())
      updateNavMesh();
   // If we can't find a mesh, just move regularly.
   if(!getNavMesh())
   {
      //setMoveDestination(pos);
      throwCallback("onPathFailed");
      return false;
   }

   // Create a new path.
   NavPath *path = new NavPath();

   path->mMesh = getNavMesh();
   path->mFrom = getPosition();
   path->mTo = pos;
   path->mFromSet = path->mToSet = true;
   path->mAlwaysRender = true;
   path->mLinkTypes = mLinkTypes;
   path->mXray = true;
   // Paths plan automatically upon being registered.
   if(!path->registerObject())
   {
      delete path;
      return false;
   }

   if(path->success())
   {
      // Clear any current path we might have.
      clearPath();
      clearCover();
      clearFollow();
      // Store new path.
      mPathData.path = path;
      mPathData.owned = true;
      // Skip node 0, which we are currently standing on.
      moveToNode(1);
      throwCallback("onPathSuccess");
      return true;
   }
   else
   {
      // Just move normally if we can't path.
      //setMoveDestination(pos, true);
      //return;
      throwCallback("onPathFailed");
      path->deleteObject();
      return false;
   }
}
コード例 #2
0
ファイル: aiPlayer.cpp プロジェクト: elfprince13/Torque3D
void AIPlayer::onRemove()
{
#ifdef TORQUE_NAVIGATION_ENABLED
   clearPath();
   clearCover();
   clearFollow();
#endif
   Parent::onRemove();
}
コード例 #3
0
ファイル: aiPlayer.cpp プロジェクト: elfprince13/Torque3D
/**
 * Stops movement for this AI
 */
void AIPlayer::stopMove()
{
   mMoveState = ModeStop;
#ifdef TORQUE_NAVIGATION_ENABLED
   clearPath();
   clearCover();
   clearFollow();
#endif
}
コード例 #4
0
void PlayerControls::setupCover()
{
    m_wSongInfo = new SongInfo(this);
    connect(ArtLoader::instance(), SIGNAL(artLoaded(bool)), m_wSongInfo, SLOT(onArtLoaded(bool)));
    connect(Player::instance(), SIGNAL(trackChanged()), m_wSongInfo, SLOT(clearCover()));

    m_mainLayout->addWidget(m_wSongInfo, 0, 0, 3, 1);
    m_mainLayout->setAlignment(m_wSongInfo, Qt::AlignBottom);
    m_mainLayout->setRowMinimumHeight(2, 43);
}
コード例 #5
0
  void CoverWidget::setCoverWidget(std::map<std::string, SAlbum *>* list) {
    if (list == NULL) return;

    coverList = list;
    it = coverList->begin();

    if (it->second == NULL) return;

    // check for voting
    //    checkIfICanVote();

    // show slide
    if (!coverList->empty())
      showCover(it->second);
    else
      clearCover();
  }