adds start instruction state and fixes some issues
This commit is contained in:
parent
e4c09b4b51
commit
31858bebd0
20 changed files with 115 additions and 36 deletions
BIN
assets/0001WaitingForGameStart.mp3
(Stored with Git LFS)
BIN
assets/0001WaitingForGameStart.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0002AfterMainstation.mp3
(Stored with Git LFS)
BIN
assets/0002AfterMainstation.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0003HackingStationMuhvella.mp3
(Stored with Git LFS)
BIN
assets/0003HackingStationMuhvella.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0004PickupStationMuhvella.mp3
(Stored with Git LFS)
BIN
assets/0004PickupStationMuhvella.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0005AfterStationMuhvella.mp3
(Stored with Git LFS)
BIN
assets/0005AfterStationMuhvella.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0006HackingStationMagie.mp3
(Stored with Git LFS)
BIN
assets/0006HackingStationMagie.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0007PickupStationMagie.mp3
(Stored with Git LFS)
BIN
assets/0007PickupStationMagie.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0009HackingBicola.mp3
(Stored with Git LFS)
BIN
assets/0009HackingBicola.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0010PickupBicola.mp3
(Stored with Git LFS)
BIN
assets/0010PickupBicola.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0012HackingTobione.mp3
(Stored with Git LFS)
BIN
assets/0012HackingTobione.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0013PickupTobione.mp3
(Stored with Git LFS)
BIN
assets/0013PickupTobione.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0014AfterTobione.mp3
(Stored with Git LFS)
BIN
assets/0014AfterTobione.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0015End.mp3
(Stored with Git LFS)
BIN
assets/0015End.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0016AfterStationMagie.mp3
(Stored with Git LFS)
BIN
assets/0016AfterStationMagie.mp3
(Stored with Git LFS)
Binary file not shown.
BIN
assets/0029Intro.mp3
(Stored with Git LFS)
Normal file
BIN
assets/0029Intro.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -182,5 +182,5 @@ void setup(void)
|
|||
}
|
||||
}
|
||||
|
||||
dfPlayer.volume(25);
|
||||
dfPlayer.volume(15);
|
||||
}
|
||||
|
|
|
@ -25,3 +25,6 @@
|
|||
#define WRONG_STATION_END 23
|
||||
#define PUT_ME_BACK_START 24
|
||||
#define PUT_ME_BACK_END 28
|
||||
|
||||
#define START_INSTRUCTIONS 29
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ WaitingForGameStart::WaitingForGameStart() = default;
|
|||
|
||||
State* WaitingForGameStart::pickedUp(const Context context)
|
||||
{
|
||||
return new OnTheMove(context.stations + 1, context.stations); // first element of the array
|
||||
return new StartInstructions(context.stations + 1);
|
||||
}
|
||||
|
||||
State* WaitingForGameStart::update(const Context context)
|
||||
|
@ -62,6 +62,51 @@ void WaitingForGameStart::activated(const Context context)
|
|||
//------------------------------------
|
||||
|
||||
|
||||
StartInstructions::StartInstructions(Station* targetStation): timer(Timer(0, false))
|
||||
{
|
||||
this->targetStation = targetStation;
|
||||
}
|
||||
|
||||
State* StartInstructions::putDown(const Context context, Station* newStation)
|
||||
{
|
||||
if (newStation == this->targetStation)
|
||||
{
|
||||
return new Hacking(targetStation);
|
||||
}
|
||||
|
||||
if (newStation == context.stations)
|
||||
{
|
||||
return new WaitingForGameStart(); // todo replace with Restarting
|
||||
}
|
||||
return new IncorrectStation(targetStation, context.stations);
|
||||
}
|
||||
|
||||
State* StartInstructions::update(const Context context)
|
||||
{
|
||||
bool done = timer.update(context.delta);
|
||||
if (done)
|
||||
{
|
||||
return new OnTheMove(targetStation, context.stations);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
String StartInstructions::updateDisplay(const Context& context)
|
||||
{
|
||||
return INTRO_TEXT;
|
||||
}
|
||||
|
||||
void StartInstructions::activated(const Context context)
|
||||
{
|
||||
context.dfPlayer->play(START_INSTRUCTIONS);
|
||||
timer = Timer(10000, false); // todo set correct time
|
||||
timer.start();
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
|
||||
|
||||
OnTheMove::OnTheMove(Station* targetStation, Station* previousStation)
|
||||
{
|
||||
this->targetStation = targetStation;
|
||||
|
@ -72,12 +117,16 @@ State* OnTheMove::putDown(const Context context, Station* newStation)
|
|||
{
|
||||
if (newStation == this->targetStation)
|
||||
{
|
||||
if (targetStation == context.stations) // first station
|
||||
if (targetStation == context.stations) // is home base?
|
||||
{
|
||||
return new End();
|
||||
}
|
||||
return new Hacking(this->targetStation);
|
||||
}
|
||||
if (newStation == context.stations)
|
||||
{
|
||||
return new WaitingForGameStart(); // todo replace with Restarting
|
||||
}
|
||||
|
||||
return new IncorrectStation(targetStation, previousStation);
|
||||
}
|
||||
|
@ -110,7 +159,7 @@ String OnTheMove::updateDisplay(const Context& context)
|
|||
{
|
||||
return BICOLA_AFTER_TEXT;
|
||||
}
|
||||
|
||||
|
||||
return "UNDEFINED";
|
||||
}
|
||||
|
||||
|
@ -223,25 +272,26 @@ String Hacking::updateDisplay(const Context& context)
|
|||
|
||||
void Hacking::activated(const Context context)
|
||||
{
|
||||
// todo change times
|
||||
auto currentStationIndex = context.getStationIndex(this->currentStation);
|
||||
if (currentStationIndex == 1)
|
||||
{
|
||||
timer = Timer(25000, false);
|
||||
timer = Timer(5000, false);
|
||||
context.dfPlayer->play(HACKING_STATION_MUHVELLA);
|
||||
}
|
||||
if (currentStationIndex == 2)
|
||||
{
|
||||
timer = Timer(29000, false);
|
||||
timer = Timer(5000, false);
|
||||
context.dfPlayer->play(HACKING_STATION_MAGIE);
|
||||
}
|
||||
if (currentStationIndex == 3)
|
||||
{
|
||||
timer = Timer(29000, false);
|
||||
timer = Timer(5000, false);
|
||||
context.dfPlayer->play(HACKING_STATION_BICOLA);
|
||||
}
|
||||
if (currentStationIndex == 4)
|
||||
{
|
||||
timer = Timer(40000, false);
|
||||
timer = Timer(5000, false);
|
||||
context.dfPlayer->play(HACKING_STATION_TOBIONE);
|
||||
}
|
||||
timer.start();
|
||||
|
@ -260,8 +310,16 @@ State* Complain::putDown(const Context context, Station* newStation)
|
|||
{
|
||||
if (this->currentStation == newStation) // was put back on correct station
|
||||
{
|
||||
if (currentStation == context.stations) // if wants to be put back on main station
|
||||
{
|
||||
return new End();
|
||||
}
|
||||
return new Hacking(this->currentStation);
|
||||
}
|
||||
if (newStation == context.stations) // if was incorrectly put back on main station
|
||||
{
|
||||
return new WaitingForGameStart(); // todo return Restarting
|
||||
}
|
||||
return this; // was not put back on correct station (just keeps complaining)
|
||||
}
|
||||
|
||||
|
|
14
src/states.h
14
src/states.h
|
@ -27,6 +27,20 @@ public:
|
|||
void activated(Context context) override;
|
||||
};
|
||||
|
||||
class StartInstructions final : public State
|
||||
{
|
||||
private:
|
||||
Station* targetStation;
|
||||
Timer timer;
|
||||
|
||||
public:
|
||||
explicit StartInstructions(Station* targetStation);
|
||||
State* putDown(Context context, Station* newStation) override;
|
||||
State* update(Context context) override;
|
||||
String updateDisplay(const Context& context) override;
|
||||
void activated(Context context) override;
|
||||
};
|
||||
|
||||
class OnTheMove final : public State
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#define WAITING_FOR_START_TEXT "Lupf mich uf"
|
||||
#define MAIN_AFTER_PICKUP_TEXT "Danke :D <3 Lueg chli ume"
|
||||
#define INTRO_TEXT "Danke :D <3"
|
||||
#define MAIN_AFTER_PICKUP_TEXT "Lueg chli ume"
|
||||
|
||||
#define MUHVELLA_HACKING_TEXT "Eifach ligge lahBitte warte"
|
||||
#define MUHVELLA_PICKUP_TEXT "Los! Witer =O"
|
||||
|
|
Loading…
Reference in a new issue