KoduConditionTimer.h
Go to the documentation of this file.00001 #ifndef KODU_CONDITION_TIMER_H_
00002 #define KODU_CONDITION_TIMER_H_
00003
00004
00005 #include <iostream>
00006
00007
00008 #include "Kodu/Primitives/KoduCondition.h"
00009 #include "Kodu/General/GeneralMacros.h"
00010 #include "Kodu/Generators/KoduGenerators.h"
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 namespace Kodu {
00021
00022 class KoduWorld;
00023
00024 class KoduConditionTimer : public KoduCondition {
00025 public:
00026
00027 KoduConditionTimer(bool useNot, const NumericGenerator& kNumericGen)
00028 : KoduCondition("KoduConditionTimer", KoduCondition::CT_TIMER),
00029 numericGen(kNumericGen),
00030 timerThreshold(0.0f),
00031 notModifierEnabled(useNot),
00032 needToInitialize(true),
00033 currentTime(0),
00034 startTime(0)
00035 { }
00036
00037
00038 KoduConditionTimer(const KoduConditionTimer& kCondition)
00039 : KoduCondition(kCondition),
00040 numericGen(kCondition.numericGen),
00041 timerThreshold(kCondition.timerThreshold),
00042 notModifierEnabled(kCondition.notModifierEnabled),
00043 needToInitialize(kCondition.needToInitialize),
00044 currentTime(kCondition.currentTime),
00045 startTime(kCondition.startTime)
00046 { }
00047
00048
00049 ~KoduConditionTimer() {
00050
00051 }
00052
00053
00054 KoduConditionTimer& operator=(const KoduConditionTimer& kCondition) {
00055 if (this != &kCondition) {
00056 KoduCondition::operator=(kCondition);
00057 numericGen = kCondition.numericGen;
00058 timerThreshold = kCondition.timerThreshold;
00059 notModifierEnabled = kCondition.notModifierEnabled;
00060 needToInitialize = kCondition.needToInitialize;
00061 currentTime = kCondition.currentTime;
00062 startTime = kCondition.startTime;
00063 }
00064 return *this;
00065 }
00066
00067
00068 virtual bool evaluate(const KoduWorld&);
00069
00070
00071 static bool isSameTypeAs(const KoduPrimitive*);
00072
00073
00074 virtual void reinitialize();
00075
00076
00077 virtual void printAttrs() const;
00078
00079
00080 float getTimeInSec();
00081
00082 private:
00083 NumericGenerator numericGen;
00084 float timerThreshold;
00085 bool notModifierEnabled;
00086 bool needToInitialize;
00087 float currentTime;
00088 float startTime;
00089 };
00090 }
00091
00092 #endif // KODU_CONDITION_TIMER_H_