ControllerPeriodicRamp.h

00001 // ----------------------------------------------------------------------------
00002 //
00003 // tagGame - Example code from the book:
00004 //
00005 //           Artficial Intelligence for Computer Games: An Introduction
00006 //           by John David Funge
00007 //
00008 //           www.ai4games.org
00009 //
00010 // Source code distributed under the Copyright (c) 2003-2007, John David Funge
00011 // Original author: John David Funge (www.jfunge.com)
00012 //
00013 // Licensed under the Academic Free License version 3.0 
00014 // (for details see LICENSE.txt in this directory).
00015 //
00016 // ----------------------------------------------------------------------------
00017 
00018 #ifndef TG_CONTROLLERPERIODIC_RAMP_H
00019 #define TG_CONTROLLERPERIODIC_RAMP_H
00020 
00021 #include "Controller.h"
00022 #include "Perception.h"
00023 
00024 namespace tagGame
00025 {
00027    class ControllerPeriodicRamp : public Controller
00028    {
00029    public:
00030       ControllerPeriodicRamp(PerceptionPtr perception,
00031                              ControllerPtr controller,
00032                              PerceptReal distance,
00033                              Real const nearDistance,
00034                              Real const farDistance,
00035                              Real const minPeriod,
00036                              Real const maxPeriod);
00037       virtual ~ControllerPeriodicRamp();
00038 
00039       inline void setMinPeriod(Real const minPeriod);
00040       inline Real getMinPeriod() const;
00041 
00042       inline void setMaxPeriod(Real const maxPeriod);
00043       inline Real getMaxPeriod() const;
00044 
00045       inline void setController(ControllerPtr controller);
00046       inline ControllerPtr getController() const;
00047 
00048       inline PerceptReal getDistance() const;
00049       inline Real getNearDistance() const;
00050       inline Real getFarDistance() const;
00051 
00052       inline void setDistance(PerceptReal const distance);
00053       inline void setNearDistance(Real const nearDistance);
00054       inline void setFarDistance(Real const farDistance);
00055 
00056       virtual void calcAction();
00057 
00058    protected:
00059       ControllerPtr controller;
00060       PerceptReal distance;
00061       Real nearDistance;
00062       Real farDistance;
00063       Real minPeriod;
00064       Real maxPeriod;
00065       Real timeOfLastDecision;
00066    private:
00067    };
00068 
00069    void ControllerPeriodicRamp::setMinPeriod(Real const minPeriod)
00070    {
00071       this->minPeriod = minPeriod;
00072    }
00073 
00074    Real ControllerPeriodicRamp::getMinPeriod() const
00075    {
00076       return minPeriod;
00077    }
00078 
00079    void ControllerPeriodicRamp::setMaxPeriod(Real const maxPeriod)
00080    {
00081       this->maxPeriod = maxPeriod;
00082    }
00083 
00084    Real ControllerPeriodicRamp::getMaxPeriod() const
00085    {
00086       return maxPeriod;
00087    }
00088 
00089    void ControllerPeriodicRamp::setController(ControllerPtr controller)
00090    {
00091       this->controller = controller;
00092    }
00093 
00094    ControllerPtr ControllerPeriodicRamp::getController() const
00095    {
00096       return controller;
00097    }
00098 
00099    PerceptReal ControllerPeriodicRamp::getDistance() const
00100    {
00101       return distance;
00102    }
00103 
00104    Real ControllerPeriodicRamp::getNearDistance() const
00105    {
00106       return nearDistance;
00107    }
00108 
00109    Real ControllerPeriodicRamp::getFarDistance() const
00110    {
00111       return farDistance;
00112    }
00113 
00114    void ControllerPeriodicRamp::setDistance(PerceptReal const distance)
00115    {
00116       this->distance = distance;
00117    }
00118 
00119    void ControllerPeriodicRamp::setNearDistance(Real const nearDistance)
00120    {
00121    this->nearDistance = nearDistance;
00122    }
00123 
00124    void ControllerPeriodicRamp::setFarDistance(Real const farDistance)
00125    {
00126       this->farDistance = farDistance;
00127    }
00128 }
00129 
00130 #endif

Generated on Sat Mar 31 22:30:54 2007 for tagGame by  doxygen 1.5.1