KoduConditionBump.h
Go to the documentation of this file.00001 #ifndef KODU_CONDITION_BUMP_H_
00002 #define KODU_CONDITION_BUMP_H_
00003
00004
00005 #include "Kodu/Primitives/KoduCondition.h"
00006 #include "Kodu/Primitives/PerceptionSearch.h"
00007 #include "Kodu/Keepers/ObjectKeeper.h"
00008
00009
00010 #include "DualCoding/ShapeRoot.h"
00011
00012
00013 #include <iostream>
00014
00015 namespace Kodu {
00016
00017 class KoduWorld;
00018
00019 class KoduConditionBump : public KoduCondition {
00020 public:
00021
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
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
00047 ~KoduConditionBump() {
00048
00049 }
00050
00051
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
00067 virtual bool evaluate(const KoduWorld&);
00068
00069
00070 const std::string& getObjectColor() const;
00071
00072
00073 const std::string& getObjectType() const;
00074
00075
00076 const DualCoding::ShapeRoot getTargetObject();
00077
00078
00079 static bool isSameTypeAs(const KoduPrimitive*);
00080
00081
00082 virtual void reinitialize();
00083
00084
00085 virtual void printAttrs() const;
00086
00087
00088 bool agentIsNearMatchingObject(const DualCoding::ShapeRoot&);
00089
00090
00091
00092 void setVisualBumpDetection(bool);
00093
00094
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_