Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

KoduConditionGot.cc

Go to the documentation of this file.
00001 // INCLUDES
00002 // tekkotsu library
00003 #include "DualCoding/ShapeRoot.h"
00004 #include "Shared/ProjectInterface.h"
00005 
00006 // tekkodu library
00007 #include "Kodu/KoduWorld.h"
00008 #include "Kodu/General/GeneralMacros.h"
00009 #include "Kodu/Primitives/KoduConditionGot.h"
00010 
00011 using namespace DualCoding;
00012 
00013 namespace Kodu {
00014 
00015     bool KoduConditionGot::evaluate(const KoduWorld& kWorldState) {
00016         const DualCoding::ShapeRoot& kGripperObjectRef = kWorldState.thisAgent.gripperObject;
00017         std::string rcolor = objColor;
00018         if ( rcolor == "" ) {
00019           if ( objType == "apple" )
00020             rcolor = "red";
00021           else if ( objType == "tree" )
00022             rcolor = "green";
00023           else if ( objType == "rock" )
00024             rcolor = "blue";
00025         }
00026         bool rv = ((kGripperObjectRef.isValid())
00027                 && (kWorldState.thisAgent.targetObjectIsInGripper)
00028                 && (ProjectInterface::getColorName(kGripperObjectRef->getColor()) == rcolor));
00029         
00030         // if the not modifier is enabled, negate the value of the return value (rv)
00031         if (notModifierEnabled)
00032             rv = !rv;
00033 
00034         // 
00035         if ((ObjectKeeper::isValid = rv) == true) {
00036             ObjectKeeper::tempObject
00037                 = ShapeRootTypeConst(kWorldState.thisAgent.gripperObject, CylinderData);
00038         }
00039 
00040         return rv;
00041     }
00042 
00043     const std::string& KoduConditionGot::getObjectColor() const {
00044         return objColor;
00045     }
00046 
00047     const std::string& KoduConditionGot::getObjectType() const {
00048         return objType;
00049     }
00050 
00051     //************* temp fix
00052     const DualCoding::ShapeRoot KoduConditionGot::getTargetObject() {
00053         return ObjectKeeper::tempObject;
00054     }
00055     //*************
00056 
00057     void KoduConditionGot::reinitialize() {
00058         KoduCondition::reinitialize();
00059     }
00060     
00061     void KoduConditionGot::printAttrs() const {
00062         KoduCondition::printAttrs();
00063         // not enabled?
00064         PRINT_ATTRS("Not enabled", notModifierEnabled);
00065         // object color and type
00066         std::cout << "Object color and type: " << objColor << " " << objType << std::endl;
00067     }
00068 }

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