Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 13, 2009, 5:05:17 PM (15 years ago)
Author:
dafrick
Message:

Hopefully merged trunk successfully into pickup branch.

Location:
code/branches/pickup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup

  • code/branches/pickup/src/orxonox/controllers/HumanController.cc

    r5781 r5935  
    3636#include "infos/PlayerInfo.h"
    3737#include "overlays/Map.h"
     38#include "graphics/Camera.h"
     39#include "sound/SoundManager.h"
     40#include "Radar.h"
     41#include "Scene.h"
    3842
    3943namespace orxonox
     
    5660    SetConsoleCommand(HumanController, dropItems,     true);
    5761    SetConsoleCommand(HumanController, useItem,       true);
     62    SetConsoleCommand(HumanController, cycleNavigationFocus,   true);
     63    SetConsoleCommand(HumanController, releaseNavigationFocus, true);
    5864
    5965    CreateUnloadableFactory(HumanController);
     
    7177    {
    7278        HumanController::localController_s = 0;
     79    }
     80
     81    void HumanController::tick(float dt)
     82    {
     83        if (GameMode::playsSound() && HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     84        {
     85            // Update sound listener
     86            Camera* camera = HumanController::localController_s->controllableEntity_->getCamera();
     87            if (camera)
     88            {
     89                SoundManager::getInstance().setListenerPosition(camera->getWorldPosition());
     90                SoundManager::getInstance().setListenerOrientation(camera->getWorldOrientation());
     91            }
     92            else
     93                COUT(3) << "HumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
     94        }
    7395    }
    7496
     
    200222            return NULL;
    201223    }
     224
     225    void HumanController::cycleNavigationFocus()
     226    {
     227        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     228            HumanController::localController_s->controllableEntity_->getScene()->getRadar()->cycleFocus();
     229    }
     230
     231    void HumanController::releaseNavigationFocus()
     232    {
     233        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     234            HumanController::localController_s->controllableEntity_->getScene()->getRadar()->releaseFocus();
     235    }
    202236}
Note: See TracChangeset for help on using the changeset viewer.