00001 /************************************************************** 00002 * Name: Sascha Becker (sab) 00003 * File: PeelEffect.H 00004 * Asgn: cavewriting 00005 * Date: Thu Dec 30 13:07:10 EST 2004 00006 **************************************************************/ 00007 00008 #ifndef PeelEffect_Header 00009 #define PeelEffect_Header 00010 00011 #include <DrawObj.H> 00012 #include <IS3D.H> 00013 #include "Word.H" 00014 #include "Effect.H" 00015 00016 using namespace std; 00017 00018 namespace cavewriting { 00019 00020 00021 class PeelEffect : public Effect { 00022 00023 public: 00024 00025 PeelEffect(Array<Word*>& words, 00026 double startTime, double duration = 100.0, 00027 const Vector3& goalPosition = Vector3(0,0,0), 00028 double startYRotation = 0.0, 00029 double goalYRotation = 0.0, 00030 bool startPaused = true); 00031 static PeelEffect* fromXML(xercesc::DOMElement * node, bool startPaused = true); 00032 virtual ~PeelEffect(); 00033 00034 virtual void animate(); 00035 00036 void setStartYRotation(double val) { _startYRotation = val; } 00037 void setGoalYRotation(double val) { _goalYRotation = val; } 00038 00039 double getStartYRotation() { return _startYRotation; } 00040 double getGoalYRotation() { return _goalYRotation; } 00041 00042 static void stopAll(); 00043 00044 protected: 00045 Vector3 _goalPosition; 00046 00051 double _goalYRotation; 00052 double _startYRotation; 00053 00054 Array<Vector3> _startPositions; 00055 bool _firstTime; 00056 bool _hasBounced; 00057 void bounce(); 00058 00059 void firstTime(); 00060 void moveWord(); 00061 bool shouldBounce(); 00062 bool shouldSurround(); 00063 void startSurround(); 00064 bool timesUp(); 00065 bool invokeEndAction(); 00066 bool collapseStarted(); 00067 00068 static bool _stopAll; 00069 private: 00070 }; 00071 } 00072 00073 #endif