Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

KoduActionScore.h

Go to the documentation of this file.
00001 #ifndef KODU_ACTION_SCORE_H_
00002 #define KODU_ACTION_SCORE_H_
00003 
00004 // C++ Library
00005 #include <iostream>
00006 
00007 // Kodu Library
00008 #include "Kodu/General/GeneralMacros.h"
00009 #include "Kodu/Generators/KoduGenerators.h"
00010 // #include "Kodu/Keepers/ScoreKeeper.h"
00011 #include "Kodu/Primitives/KoduAction.h"
00012 
00013 /**
00014  * NAME:            KODU ACTION SCORE
00015  * TYPE:            ACTION
00016  * KODU EQUIVALENT: SCORE
00017  * DESCRIPTION:
00018  *      This class is used to add, subtract, and set a particular score using a key (score designator).
00019 **/
00020 
00021 namespace Kodu {
00022 
00023     // Forward declare the ScoreChange class
00024     class ScoreChange;
00025     
00026     //! Kodu Action Score (derived from Kodu Action)
00027     class KoduActionScore : public KoduAction {
00028     public:
00029         enum ScoringType_t {
00030             ST_SCORE = 0,
00031             ST_SET_SCORE,
00032             ST_SUBTRACT
00033         };
00034 
00035         //! Constructor
00036         KoduActionScore(ScoringType_t scoreOpType, const NumericGenerator& kNumericGen,
00037             const std::string& kDesignator, bool useOnce)
00038           : KoduAction("KoduActionScore", KoduAction::AT_SCORING, true, useOnce),
00039             type(scoreOpType),
00040             numericGen(kNumericGen),
00041             designator(kDesignator)
00042         { }
00043 
00044         //! Copy constructor
00045         KoduActionScore(const KoduActionScore& kAction)
00046           : KoduAction(kAction),
00047             type(kAction.type),
00048             numericGen(kAction.numericGen),
00049             designator(kAction.designator)//,
00050             // onceEnabled(kAction.onceEnabled)
00051         { }
00052         
00053         //! Destructor
00054         ~KoduActionScore() {
00055             // no explicit implementation
00056         }
00057         
00058         //! Assignment operator
00059         KoduActionScore& operator=(const KoduActionScore& kAction) {
00060             if (this == &kAction) {
00061                 KoduAction::operator=(kAction);
00062                 type = kAction.type;
00063                 numericGen = kAction.numericGen;
00064                 designator = kAction.designator;
00065                 // onceEnabled = kAction.onceEnabled;
00066             }
00067             return *this;
00068         }
00069 
00070         //! Returns the score change
00071         ScoreChange getScoreChange();
00072 
00073         //! Tests if the primitive argument is the same as the calling class
00074         static bool isSameTypeAs(const KoduPrimitive*);
00075 
00076         //! Used to reinitialize certain variables (e.g. when switching to another page)
00077         virtual void reinitialize();
00078 
00079         //! Prints the attributes of a particular instance
00080         virtual void printAttrs() const;
00081 
00082     private:
00083         ScoringType_t type;             //!< States whether a score is incremented, decremented, or set
00084         NumericGenerator numericGen;    //!< Generates a numeric value
00085         std::string designator;         //!< The score designator
00086     };
00087 }
00088 
00089 #endif // KODU_ACTION_SCORE_H_

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