You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SeasonI/trigger.h

73 lines
1.9 KiB

#ifndef TRIGGER_H
#define TRIGGER_H
#include "cutscene.h"
#include "pixelGameEngine.h"
#include "flags.h"
#include "SeasonI.h"
using namespace olc;
namespace TriggerName{
//When adding new triggers to the list, you will have to add a new line to trigger.cpp to get it to appear in the editor.
enum Trigger{
NONE,
START_CUTSCENE_1,
GOTO_TWOSON_MAP,
GOTO_ONETT_MAP
};
}
extern void DisplayMessageBox(std::string targetT);
extern SeasonI*GAME;
extern std::map<CutsceneName::Cutscene,Cutscene*> CUTSCENES;
class Trigger{
vi2d pos;
vi2d size;
TriggerName::Trigger id;
vi2d extraCoords;
public:
Trigger(vi2d pos,vi2d size,TriggerName::Trigger id,vi2d extraCoords={0,0})
:pos(pos),size(size),id(id),extraCoords(extraCoords){}
bool IsInside(vd2d point) {
return point.x>pos.x&&point.x<pos.x+size.x&&point.y>pos.y&&point.y<pos.y+size.y;
}
void Interact() {
switch (id) {
case TriggerName::START_CUTSCENE_1:{
if (!GAME->GetGameFlag(Flag::TEST_FLAG1)) {
DisplayMessageBox("You have triggered this scene.");
GAME->SetGameFlag(Flag::TEST_FLAG1,true);
}
}break;
case TriggerName::GOTO_TWOSON_MAP:{
GAME->StartCutscene(CUTSCENES[CutsceneName::TRANSFER_MAP_TWOSON_CUTSCENE]);
}break;
case TriggerName::GOTO_ONETT_MAP:{
GAME->StartCutscene(CUTSCENES[CutsceneName::TRANSFER_MAP_ONETT_CUTSCENE]);
}break;
}
}
vi2d GetPos() {
return pos;
}
vi2d GetSize() {
return size;
}
int GetPosX() {
return pos.x;
}
int GetPosY() {
return pos.y;
}
int GetSizeX() {
return size.x;
}
int GetSizeY() {
return size.y;
}
int GetID() {
return id;
}
};
#endif