📄 task.cpp
字号:
// Task.cpp
//
/////////////////////////////////////////////////////////////////////////////
#include <cassert>
#include "ScheduledTasks.h"
#include "Task.h"
// all possible tasks
ScheduledTask * Task::tasks[10] = {
};
/////////////////////////////////////////////////////////////////////////////
// initialization and cleanup
/////////////////////////////////////////////////////////////////////////////
Task::Task(int taskId, TimeUnits units, int time)
{
id = taskId;
timeUnits = units;
remainingUnits = time;
}
Task::~Task()
{
}
void Task::initScheduledTasksList()
{
tasks[0] = new IncrementPlayingSubstate();
tasks[1] = new IncrementCoinInsertedSubstate();
tasks[2] = new IncrementDemoSubstate();
tasks[3] = new IncrementGhostDeadSubstate();
tasks[4] = new ClearFruit();
tasks[5] = new ClearFruitPoints();
tasks[6] = new ClearReadyMessage();
tasks[7] = new IncrementCutscene1Substate();
tasks[8] = new IncrementCutscene2Substate();
tasks[9] = new IncrementCutscene3Substate();
}
void Task::endScheduledTasksList()
{
for (int i = 0; i < 10; i++){
delete tasks[i];
}
}
// executes the task
void Task::execute()
{
assert((id >= 0) && (id <= 9));
tasks[id]->execute();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -