Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

KoduConditionBump.h

Go to the documentation of this file.
00001 #ifndef KODU_CONDITION_BUMP_H_
00002 #define KODU_CONDITION_BUMP_H_
00003 
00004 // Tekkodu Library
00005 #include "Kodu/Primitives/KoduCondition.h"
00006 #include "Kodu/Primitives/PerceptionSearch.h"
00007 #include "Kodu/Keepers/ObjectKeeper.h"
00008 
00009 // Tekkotsu Library
00010 #include "DualCoding/ShapeRoot.h"
00011 
00012 // C++ Library
00013 #include <iostream>
00014 
00015 namespace Kodu {
00016 
00017     class KoduWorld;
00018 
00019     class KoduConditionBump : public KoduCondition {
00020     public:
00021         //! Constructor
00022         KoduConditionBump(bool useNot, const std::string& kObjectType, const std::string& kObjectColor,
00023             SearchLocation_t locationToSearch)
00024           : KoduCondition("KoduConditionBump", KoduCondition::CT_BUMP),
00025             notModifierEnabled(useNot),
00026             objType(kObjectType),
00027             objColor(kObjectColor),
00028             searchLocation(locationToSearch),
00029             refdObject(),
00030             agentLastPosAfterDetection(),
00031             visuallyDetectedBump(false)
00032         { }
00033 
00034         //! Copy constructor
00035         KoduConditionBump(const KoduConditionBump& kCondition)
00036           : KoduCondition(kCondition),
00037             notModifierEnabled(kCondition.notModifierEnabled),
00038             objType(kCondition.objType),
00039             objColor(kCondition.objColor),
00040             searchLocation(kCondition.searchLocation),
00041             refdObject(kCondition.refdObject),
00042             agentLastPosAfterDetection(kCondition.agentLastPosAfterDetection),
00043             visuallyDetectedBump(kCondition.visuallyDetectedBump)
00044         { }
00045 
00046         //! Destructor
00047         ~KoduConditionBump() {
00048             // no explicit implementation
00049         }
00050 
00051         //! Assignment operator
00052         KoduConditionBump& operator=(const KoduConditionBump& kCondition) {
00053             if (this != &kCondition) {
00054                 KoduCondition::operator=(kCondition);
00055                 notModifierEnabled = kCondition.notModifierEnabled;
00056                 objType = kCondition.objType;
00057                 objColor = kCondition.objColor;
00058                 searchLocation = kCondition.searchLocation;
00059                 refdObject = kCondition.refdObject;
00060                 agentLastPosAfterDetection = kCondition.agentLastPosAfterDetection;
00061                 visuallyDetectedBump = kCondition.visuallyDetectedBump;
00062             }
00063             return *this;
00064         }
00065 
00066         //! Checks if a specified object was bumped
00067         virtual bool evaluate(const KoduWorld&);
00068 
00069         //! Returns a specified object's color
00070         const std::string& getObjectColor() const;
00071 
00072         //! Returns a specified object's type
00073         const std::string& getObjectType() const;
00074 
00075         //! Returns the target object... if none is available, return an invalid object
00076         const DualCoding::ShapeRoot getTargetObject();
00077 
00078         //! Tests if the primitive argument is the same as the calling class
00079         static bool isSameTypeAs(const KoduPrimitive*);
00080 
00081         //! Used to reinitialize certain variables (e.g. when switching to another page)
00082         virtual void reinitialize();
00083         
00084         //! Prints the attributes of a particular instance
00085         virtual void printAttrs() const;
00086 
00087         //******************* temp fix
00088         bool agentIsNearMatchingObject(const DualCoding::ShapeRoot&);
00089         //*******************
00090         //bool agentIsNearMatchingObject();
00091 
00092         void setVisualBumpDetection(bool);
00093 
00094         //! The maximum distance the agent can be away from an object to sense a "bump"
00095         static const float kMaxDistanceAwayToSenseBump;
00096         
00097     private:
00098         bool notModifierEnabled;
00099         std::string objType;
00100         std::string objColor;
00101         SearchLocation_t searchLocation;
00102         DualCoding::ShapeRoot refdObject;
00103         DualCoding::Point agentLastPosAfterDetection;
00104         bool visuallyDetectedBump;
00105     };
00106 }
00107 
00108 #endif // KODU_CONDITION_BUMP_H_

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:43 2016 by Doxygen 1.6.3