#include <src/orxonox/objects/controllers/PongAI.h>
Public Member Functions | |
PongAI (BaseObject *creator) | |
void | setConfigValues () |
Function to collect the SetConfigValue-macro calls. | |
void | setPongBall (PongBall *ball) |
virtual void | tick (float dt) |
Gets called every frame. | |
virtual | ~PongAI () |
Protected Member Functions | |
void | calculateBallEndPosition () |
void | calculateRandomOffset () |
void | delayedMove () |
void | move (char direction, bool bUseDelay) |
Protected Attributes | |
PongBall * | ball_ |
Vector2 | ballDirection_ |
float | ballEndPosition_ |
bool | bOscillationAvoidanceActive_ |
char | movement_ |
char | oldMove_ |
float | randomOffset_ |
std::list< std::pair< Timer < PongAI > *, char > > | reactionTimers_ |
float | relHysteresisOffset_ |
float | strength_ |
orxonox::PongAI::PongAI | ( | BaseObject * | creator | ) |
orxonox::PongAI::~PongAI | ( | ) | [virtual] |
References reactionTimers_.
void orxonox::PongAI::calculateBallEndPosition | ( | ) | [protected] |
References ball_, ballEndPosition_, orxonox::PongBall::getFieldDimension(), orxonox::WorldEntity::getPosition(), orxonox::MobileEntity::getVelocity(), orxonox::PongBall::MAX_REL_Z_VELOCITY, orxonox::rnd(), orxonox::sgn(), strength_, orxonox::MT_Type::Vector2, and orxonox::MT_Type::Vector3.
Referenced by tick().
void orxonox::PongAI::calculateRandomOffset | ( | ) | [protected] |
References ball_, orxonox::PongBall::getBatLength(), orxonox::PongBall::getFieldDimension(), randomOffset_, orxonox::rnd(), orxonox::rndsgn(), and strength_.
Referenced by tick().
void orxonox::PongAI::delayedMove | ( | ) | [protected] |
void orxonox::PongAI::move | ( | char | direction, | |
bool | bUseDelay | |||
) | [protected] |
References orxonox::createExecutor(), orxonox::delay(), delayedMove(), orxonox::MAX_REACTION_TIME, movement_, reactionTimers_, and strength_.
Referenced by tick().
void orxonox::PongAI::setConfigValues | ( | ) |
Function to collect the SetConfigValue-macro calls.
Reimplemented from orxonox::OrxonoxClass.
References SetConfigValue, and strength_.
Referenced by PongAI().
void orxonox::PongAI::setPongBall | ( | PongBall * | ball | ) | [inline] |
Referenced by orxonox::Pong::spawnPlayer().
void orxonox::PongAI::tick | ( | float | dt | ) | [virtual] |
Gets called every frame.
dt | The time since the last frame in seconds |
Implements orxonox::Tickable.
References ball_, ballDirection_, ballEndPosition_, bOscillationAvoidanceActive_, calculateBallEndPosition(), calculateRandomOffset(), orxonox::delay(), orxonox::Controller::getControllableEntity(), orxonox::PongBall::getFieldDimension(), orxonox::WorldEntity::getPosition(), orxonox::MobileEntity::getVelocity(), move(), orxonox::ControllableEntity::moveFrontBack(), movement_, oldMove_, randomOffset_, relHysteresisOffset_, orxonox::sgn(), and orxonox::MT_Type::Vector3.
PongBall* orxonox::PongAI::ball_ [protected] |
Referenced by calculateBallEndPosition(), calculateRandomOffset(), PongAI(), and tick().
Vector2 orxonox::PongAI::ballDirection_ [protected] |
float orxonox::PongAI::ballEndPosition_ [protected] |
Referenced by calculateBallEndPosition(), PongAI(), and tick().
bool orxonox::PongAI::bOscillationAvoidanceActive_ [protected] |
char orxonox::PongAI::movement_ [protected] |
Referenced by delayedMove(), move(), PongAI(), and tick().
char orxonox::PongAI::oldMove_ [protected] |
float orxonox::PongAI::randomOffset_ [protected] |
Referenced by calculateRandomOffset(), PongAI(), and tick().
std::list<std::pair<Timer<PongAI>*, char> > orxonox::PongAI::reactionTimers_ [protected] |
Referenced by delayedMove(), move(), and ~PongAI().
float orxonox::PongAI::relHysteresisOffset_ [protected] |
float orxonox::PongAI::strength_ [protected] |
Referenced by calculateBallEndPosition(), calculateRandomOffset(), move(), PongAI(), and setConfigValues().