KoduAction.h
Go to the documentation of this file.00001 #ifndef KODU_ACTION_H_
00002 #define KODU_ACTION_H_
00003
00004
00005 #include <iostream>
00006 #include <string>
00007
00008
00009 #include "Kodu/Primitives/KoduPrimitive.h"
00010 #include "Kodu/General/GeneralMacros.h"
00011
00012
00013 #include "Kodu/General/KoduState.h"
00014
00015 namespace Kodu {
00016
00017
00018 class KoduAction : public KoduPrimitive {
00019 public:
00020
00021 enum ActionTypes {
00022 AT_DO_NOTHING = 0,
00023 AT_DROP,
00024 AT_GRAB,
00025 AT_GIVE,
00026 AT_MOTION,
00027 AT_PAGE_SWITCH,
00028 AT_PLAY,
00029 AT_SAY,
00030 AT_SCORING
00031 };
00032
00033
00034 KoduAction(const std::string& kActionName, ActionTypes actType, bool actionCanUseOnceMod, bool runOnce) :
00035 KoduPrimitive(kActionName), actionType(actType), onceModEnabled(actionCanUseOnceMod && runOnce), state()
00036 { }
00037
00038
00039 explicit KoduAction(const KoduAction& kAction) : KoduPrimitive(kAction),
00040 actionType(kAction.actionType), onceModEnabled(kAction.onceModEnabled), state(kAction.state)
00041 { }
00042
00043
00044 virtual ~KoduAction () {}
00045
00046
00047
00048 KoduAction& operator=(const KoduAction& kAction) {
00049 if (this != &kAction) {
00050 KoduPrimitive::operator=(kAction);
00051 actionType = kAction.actionType;
00052 onceModEnabled = kAction.onceModEnabled;
00053 state = kAction.state;
00054 }
00055 return *this;
00056 }
00057
00058
00059 bool canRun() const {
00060 return KoduPrimitive::agentCanUsePrimitive();
00061 }
00062
00063
00064 bool onceModIsEnabled() const {
00065 return onceModEnabled;
00066 }
00067
00068
00069 virtual void reinitialize() {
00070 KoduPrimitive::reinitialize();
00071 }
00072
00073
00074 void setActionCanRun(bool bVal) {
00075 actionCanRun = bVal;
00076 }
00077 */
00078
00079 ActionTypes getActionType() const { return actionType; }
00080
00081
00082 virtual void printAttrs() const {
00083 KoduPrimitive::printAttrs();
00084 PRINT_ATTRS("Once modifier enabled", onceModEnabled);
00085 }
00086
00087 void setKoduState(const KoduState& curstate){
00088 state = curstate;
00089 }
00090
00091 private:
00092 ActionTypes actionType;
00093 bool onceModEnabled;
00094 KoduState state;
00095 };
00096
00097 }
00098
00099 #endif // end of KODU_ACTION_H_