blob: 88cd3d27b73a57a9fe9ab9e3f737f9346682dc49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#include "stdafx.h"
#include "Tutorial.h"
#include "AreaTask.h"
AreaTask::AreaTask(eTutorial_State state, Tutorial *tutorial, vector<TutorialConstraint *> *inConstraints, int descriptionId, EAreaTaskCompletionStates completionState)
: TutorialTask( tutorial, descriptionId, false, inConstraints, false, false, false )
{
m_tutorialState = state;
if(m_tutorialState == e_Tutorial_State_Gameplay)
{
enableConstraints(true);
}
m_completionState = completionState;
}
bool AreaTask::isCompleted()
{
if(bIsCompleted) return true;
bool complete = false;
switch(m_completionState)
{
case eAreaTaskCompletion_CompleteOnConstraintsSatisfied:
{
bool allSatisfied = true;
for( auto& constraint : constraints )
{
if(!constraint->isConstraintSatisfied(tutorial->getPad()))
{
allSatisfied = false;
break;
}
}
complete = allSatisfied;
}
break;
case eAreaTaskCompletion_CompleteOnActivation:
complete = bHasBeenActivated;
break;
};
bIsCompleted = complete;
return complete;
}
void AreaTask::setAsCurrentTask(bool active)
{
TutorialTask::setAsCurrentTask(active);
if(m_completionState == eAreaTaskCompletion_CompleteOnConstraintsSatisfied)
{
enableConstraints(active);
}
}
void AreaTask::onStateChange(eTutorial_State newState)
{
if(m_completionState == eAreaTaskCompletion_CompleteOnActivation)
{
if(m_tutorialState == newState)
{
enableConstraints(true);
}
else if(m_tutorialState != e_Tutorial_State_Gameplay)
{
//enableConstraints(false);
}
}
}
|