ControllerConditional.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_CONTROLLERCONDITIONAL_H
00019 #define TG_CONTROLLERCONDITIONAL_H
00020 
00021 #include "Controller.h"
00022 #include "Perception.h"
00023 
00024 namespace tagGame
00025 {
00027    class ControllerConditional : public Controller
00028    {
00029    public:
00030       ControllerConditional(PerceptionPtr perception, PerceptBool condition, ControllerPtr controllerTrue, ControllerPtr controllerFalse);
00031       virtual ~ControllerConditional();
00032 
00033       inline PerceptBool getCondition();
00034       inline ControllerPtr getControllerTrue();
00035       inline ControllerPtr getControllerFalse();
00036 
00037       inline void setCondition(PerceptBool condition);
00038       inline void setControllerTrue(ControllerPtr controllerTrue);
00039       inline void setControllerFalse(ControllerPtr controllerFalse);
00040 
00041       virtual void calcAction();
00042 
00043    protected:
00044       PerceptBool condition;
00045       ControllerPtr controllerTrue;
00046       ControllerPtr controllerFalse;
00047    private:
00048    };
00049 
00050    void ControllerConditional::setCondition(PerceptBool condition)
00051    {
00052       this->condition = condition;
00053    }
00054    
00055    PerceptBool ControllerConditional::getCondition()
00056    {
00057       return condition;
00058    }
00059    
00060    void ControllerConditional::setControllerTrue(ControllerPtr controllerTrue)
00061    {
00062       this->controllerTrue = controllerTrue;
00063    }
00064    
00065    ControllerPtr ControllerConditional::getControllerTrue()
00066    {
00067       return controllerTrue;
00068    }
00069    
00070    void ControllerConditional::setControllerFalse(ControllerPtr controllerFalse)
00071    {
00072       this->controllerFalse= controllerFalse;
00073    }
00074    
00075    ControllerPtr ControllerConditional::getControllerFalse()
00076    {
00077       return controllerFalse;
00078    }
00079 }
00080 
00081 #endif

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