summaryrefslogtreecommitdiff
path: root/gaunt01/src/trapdoor.h
blob: 6f8b509605bdb2a498944753fd6e3b3a83adfb1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef TRAPDOOR_H
#define TRAPDOOR_H

#include "ofMain.h"
#include "morphmesh.h"
#include "normBindTexture.h"
#include "player.h"

/*
const vector<ofxCvBlob>& blobs

receive vector of player positions
needs to 'debounce' - time threshold for activation

creaking sound player
*/

class trapdoor
{
	public:
		trapdoor(ofVec2f _boundTR=ofVec2f(0,0),ofVec2f _boundBR=ofVec2f(0,0),ofVec2f _doorSize=ofVec2f(10,10));
		virtual ~trapdoor();

		bool checkUpdate(map<int,player>& players);
		void draw();
		void drawSplash(float angle);
		void drawDebug();
		void start();
		void startPos(ofVec2f pos);

		vector<ofVec2f> getCorners();
		ofVec2f bounds2UV(ofVec2f pt);

		void setBoundingRect(float x,float y, float width,float height);
		ofRectangle getBoundingRect();
		ofRectangle getInnerRect();
		void trigger();
		float getoffset();

		float getFalldist();
	
		ofImage* splashFrames; //temp public
	protected:
	private:
		morphmesh surround;
		morphmesh lid;

		ofVec2f position;
		ofVec2f boundTR;
		ofVec2f boundBR;
		ofVec2f size;

		float startTime;
		float triggerTime; //time threshold

		ofRectangle boundingRect;
		ofVec2f doorSize;

		float doorAngle;
		float doorSpeed;

		ofImage texture;

		ofSoundPlayer*  sounds;
		

		bool opening;

		float triggeredTime;
		vector<player*> caught;
		vector<float> caughtTime;

};

#endif // TRAPDOOR_H