#pragma once
#include "olcUTIL_Camera2D.h"
#include "Textbox.h"
#include "Unit.h"
#include "olcPGEX_AudioSource.h"
#include "olcPGEX_TransformedView.h"
#include "GameFlags.h"
#include "Level.h"

class Scenario{
public:
	Scenario(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
	virtual~Scenario();
	void _Start();
	void Draw();
	virtual void Start();
	void _Update();
	bool transitionToNextLevel=false;
	LevelName nextLevel=LevelName::STAGE1;
protected:
	void DisplayBox(std::string text,bool scaryHoodedFigure=false);
	void SetCameraTarget(vf2d pos,bool instant=false);
	void SetObjective(std::string objective);
	void RevealTiles(vf2d pos);
	virtual bool MissionCompleted();
	virtual void Update();
	int state=0;
	utils::Camera2D camera;
	vf2d targetPos;
	Textbox box;
	float initialWaitTime=3;
	bool missionCompleted=false;
	float missionFinishWaitTime=3;
	float missionCompletedTimer=0;
	float smallTimePass=0;
	std::vector<std::shared_ptr<Unit>>&units;
	std::vector<std::unique_ptr<Renderable>>&IMAGES;
	std::vector<std::unique_ptr<Audio>>&SOUNDS;
	GameFlags&flags;
	std::string&objective;
	TileTransformedView&game;
};

class Stage1:public Scenario{
public:
	Stage1(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
protected:
	void Start();
	void Update();
	bool MissionCompleted();
};
class Stage2:public Scenario{
public:
	Stage2(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
protected:
	void Start();
	void Update();
	bool MissionCompleted();
};
class Stage3:public Scenario{
public:
	Stage3(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
protected:
	void Start();
	void Update();
	bool MissionCompleted();
};
class Stage4:public Scenario{
public:
	Stage4(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
protected:
	void Start();
	void Update();
	bool MissionCompleted();
};
class Stage5:public Scenario{
public:
	Stage5(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
protected:
	void Start();
	void Update();
	bool MissionCompleted();
};
class Stage6:public Scenario{
public:
	Stage6(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
protected:
	void Start();
	void Update();
	bool MissionCompleted();
};
class Stage7:public Scenario{
public:
	Stage7(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
protected:
	void Start();
	void Update();
	bool MissionCompleted();
};
class Stage8:public Scenario{
public:
	Stage8(std::vector<std::shared_ptr<Unit>>&units,std::vector<std::unique_ptr<Renderable>>&IMAGES,std::vector<std::unique_ptr<Audio>>&SOUNDS,std::string&objective,TileTransformedView&game,GameFlags&flags);
protected:
	void Start();
	void Update();
	bool MissionCompleted();
};