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.
VirusAttack/olcCodeJam2023Entry/Scenario.h

116 lines
4.5 KiB

#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(Resources&enemy_resources,std::vector<std::shared_ptr<CollectionPoint>>&collectionPoints,int availableMemory,std::vector<std::shared_ptr<Unit>>&queuedUnits,std::vector<std::unique_ptr<Audio>>&SOUNDS);
bool transitionToNextLevel=false;
LevelName nextLevel=LevelName::STAGE1;
void RunAI(Resources&enemy_resources,std::vector<std::shared_ptr<CollectionPoint>>&collectionPoints,int availableMemory,std::vector<std::shared_ptr<Unit>>&queuedUnits,std::vector<std::unique_ptr<Audio>>&SOUNDS);
bool setupEasyMode=false;
float attackTimer=120;
std::map<CollectionPoint*,float>cpCheckTimer;
bool AttemptBuild(UnitType unit,vf2d pos,std::vector<Memory>&resourceCost,Resources&enemy_resources,int availableMemory,std::vector<std::shared_ptr<Unit>>&queuedUnits);
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;
float unitBuildTimer=0;
};
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:
float oopsTimer=0.3;
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);
int collectorsAttached=0;
float nextLevelTimer=0;
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();
};