File tree Expand file tree Collapse file tree 10 files changed +39
-24
lines changed Expand file tree Collapse file tree 10 files changed +39
-24
lines changed Original file line number Diff line number Diff line change @@ -303,8 +303,16 @@ public void UpdateGameQuest()
303
303
//Check if the completed levels are two
304
304
public void CheckLevelsCompleted ( )
305
305
{
306
+ int passedLevels = 0 ;
307
+
308
+ for ( int i = 0 ; i < levelsCompleted . Count ; i ++ )
309
+ {
310
+ if ( levelsCompleted [ i ] )
311
+ passedLevels ++ ;
312
+ }
313
+
306
314
// Look in the list of level completed if the two levels are completed
307
- if ( levelsCompleted [ 0 ] && levelsCompleted [ 1 ] )
315
+ if ( passedLevels >= 2 )
308
316
{
309
317
// Call the game manager to complete the questionnaire
310
318
UpdateGameQuest ( ) ;
@@ -315,6 +323,8 @@ public void QuitActivityOne()
315
323
{
316
324
AudioManager . Instance . PlaySound ( SoundType . ActivityBtnSfx ) ;
317
325
Activity . Instance . activityOne . SetActive ( false ) ;
326
+ SelectionManager . instance . isInteracting = false ;
327
+ SelectionManager . instance . canHighlight = true ;
318
328
EnableWorldMap ( ) ;
319
329
}
320
330
Original file line number Diff line number Diff line change @@ -266,8 +266,9 @@ public void CheckLevelsCompleted()
266
266
public void QuitActivityTwo ( )
267
267
{
268
268
AudioManager . Instance . PlaySound ( SoundType . ActivityBtnSfx ) ;
269
-
270
269
Activity . Instance . activityThree . SetActive ( false ) ;
270
+ SelectionManager . instance . isInteracting = false ;
271
+ SelectionManager . instance . canHighlight = true ;
271
272
EnableWorldMap ( ) ;
272
273
}
273
274
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ public void UpdateGameQuest()
57
57
public void QuitActivityThree ( )
58
58
{
59
59
AudioManager . Instance . PlaySound ( SoundType . ActivityBtnSfx ) ;
60
- Activity . Instance . activityTwo . SetActive ( false ) ;
60
+ Activity . Instance . activityTwo . SetActive ( false ) ;
61
+ SelectionManager . instance . isInteracting = false ;
62
+ SelectionManager . instance . canHighlight = true ;
61
63
EnableWorldMap ( ) ;
62
64
}
63
65
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ void Update()
78
78
public void StartConversation ( TextAsset inkJSON )
79
79
{
80
80
SelectionManager . instance . isInteracting = true ;
81
+ SelectionManager . instance . canHighlight = false ;
81
82
DisableObjects . Instance . ToggleSelectionCursor ( ) ;
82
83
DisableObjects . Instance . ToggleTooltip ( ) ;
83
84
DisableObjects . Instance . disableCharacterController ( ) ;
@@ -103,6 +104,7 @@ private void EndDialogue()
103
104
isTalking = false ;
104
105
dialogueUI . dialogueUI . SetActive ( false ) ;
105
106
SelectionManager . instance . isInteracting = false ;
107
+ SelectionManager . instance . canHighlight = true ;
106
108
EventManager . Photograph . OnActiveCamera ( true ) ;
107
109
DisableObjects . Instance . ToggleSelectionCursor ( ) ;
108
110
DisableObjects . Instance . ToggleTooltip ( ) ;
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ public override void Interact()
42
42
DisableObjects . Instance . disableCharacterController ( ) ;
43
43
DisableObjects . Instance . disableCameras ( ) ;
44
44
DisableObjects . Instance . disableSwitchCamera ( ) ;
45
+ SelectionManager . instance . canHighlight = false ;
46
+ SelectionManager . instance . isInteracting = true ;
45
47
46
48
if ( itemName == "Activity1" ) {
47
49
activityOne . SetActive ( true ) ;
Original file line number Diff line number Diff line change @@ -44,14 +44,7 @@ public void Update()
44
44
45
45
public override void Interact ( )
46
46
{
47
-
48
- if ( ! DialogueManager . instance . isTalking )
49
- {
50
- DialogueManager . instance . StartConversation ( inkJSON ) ;
51
-
52
- //CameraUtilityManager.Instance.SetCameraOnCharacter(transform);
53
- }
54
-
47
+ DialogueManager . instance . StartConversation ( inkJSON ) ;
55
48
}
56
49
57
50
protected override void handleCollision ( Collider other )
Original file line number Diff line number Diff line change @@ -34,7 +34,6 @@ public class Letter : InteractableObject
34
34
35
35
public override void Interact ( )
36
36
{
37
- base . Interact ( ) ; // Do not remove - child calls parent method
38
37
39
38
DisableObjects . Instance . disableSwitchCamera ( ) ;
40
39
DisableObjects . Instance . disableCameras ( ) ;
@@ -44,13 +43,17 @@ public override void Interact()
44
43
45
44
if ( toggle )
46
45
{
46
+ SelectionManager . instance . canHighlight = false ;
47
+ SelectionManager . instance . oneTimeInteraction = true ;
47
48
turnOn ( ) ;
48
49
EventManager . Photograph . OnActiveCamera ( false ) ;
49
50
EventManager . QuestUI . OnLockQuestUI ( ) ;
50
51
EventManager . Minimap . OnLockMiniMap ( ) ;
51
52
}
52
53
else
53
54
{
55
+ SelectionManager . instance . canHighlight = true ;
56
+ SelectionManager . instance . oneTimeInteraction = false ;
54
57
turnOff ( ) ;
55
58
EventManager . Photograph . OnActiveCamera ( true ) ;
56
59
EventManager . QuestUI . OnUnlockQuestUI ( ) ;
Original file line number Diff line number Diff line change @@ -47,8 +47,6 @@ public class TV : InteractableObject
47
47
// Interact with the TV
48
48
public override void Interact ( )
49
49
{
50
- base . Interact ( ) ; // Do not remove - child calls parent method
51
-
52
50
disableObjects . TogglePlayer ( ) ;
53
51
disableObjects . ToggleSelectionCursor ( ) ;
54
52
@@ -65,13 +63,17 @@ public override void Interact()
65
63
66
64
if ( isOn )
67
65
{
66
+ SelectionManager . instance . oneTimeInteraction = true ;
67
+ SelectionManager . instance . canHighlight = false ;
68
68
EventManager . Minimap . OnLockMiniMap . Invoke ( ) ;
69
69
EventManager . Photograph . OnActiveCamera ( false ) ;
70
70
AudioManager . Instance . PlaySound ( SoundType . TVOn ) ;
71
71
ActiveTV ( ) ;
72
72
}
73
73
else
74
74
{
75
+ SelectionManager . instance . oneTimeInteraction = false ;
76
+ SelectionManager . instance . canHighlight = true ;
75
77
EventManager . Minimap . OnUnlockMiniMap . Invoke ( ) ;
76
78
EventManager . Photograph . OnActiveCamera ( true ) ;
77
79
AudioManager . Instance . PlaySound ( SoundType . TvOff ) ;
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ public class SelectionManager : MonoBehaviour
12
12
public static SelectionManager instance ;
13
13
public bool isInteracting ;
14
14
public bool onTarget ;
15
+ public bool canHighlight ;
16
+ public bool oneTimeInteraction ;
15
17
16
18
[ SerializeField ]
17
19
private GameObject textBox ;
@@ -36,6 +38,7 @@ private void Awake()
36
38
private void Start ( )
37
39
{
38
40
onTarget = false ;
41
+ canHighlight = true ;
39
42
interaction_text = textBox . GetComponentInChildren < Image > ( ) . GetComponentInChildren < TextMeshProUGUI > ( ) ;
40
43
}
41
44
@@ -58,23 +61,21 @@ void Update()
58
61
59
62
interactable = selectionTransform . GetComponent < InteractableObject > ( ) ;
60
63
61
- if ( interactable != null && interactable . playerInRange && ! WallAlertUI . state )
64
+ if ( interactable != null && ( interactable . playerInRange || oneTimeInteraction ) && ! isInteracting )
62
65
{
63
66
if ( interactable != lastInteractable )
64
67
{
65
68
lastInteractable = interactable ;
66
69
}
67
70
68
71
69
- interactable . GetComponent < Outline > ( ) . enabled = ! isInteracting ;
72
+ interactable . GetComponent < Outline > ( ) . enabled = canHighlight ;
70
73
SetText ( interactable . GetSelectionPrompt ( ) ) ;
71
74
72
75
if ( Input . GetKeyDown ( KeyCode . E ) )
73
76
{
74
- if ( ! DialogueManager . instance . isTalking )
75
- {
76
- interactable . Interact ( ) ;
77
- }
77
+ Debug . Log ( "Interacting with " + interactable . name ) ;
78
+ interactable . Interact ( ) ;
78
79
}
79
80
}
80
81
else
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ public class WallAlertUI : MonoBehaviour
8
8
{
9
9
public GameObject alertWall ;
10
10
private TextMeshProUGUI alertWallText ;
11
- public static bool state ;
12
11
13
12
void OnEnable ( )
14
13
{
@@ -28,9 +27,9 @@ public void Start()
28
27
29
28
public void setActiveAlertWall ( int module , bool state )
30
29
{
31
- WallAlertUI . state = state ;
32
- Debug . Log ( "Current wall state is " + WallAlertUI . state ) ;
33
- alertWall . SetActive ( WallAlertUI . state ) ;
30
+ SelectionManager . instance . isInteracting = state ;
31
+ Debug . Log ( "Current wall state is " + state ) ;
32
+ alertWall . SetActive ( state ) ;
34
33
alertWallText . text = "No puedes pasar sin antes completar todas las tareas del módulo " + module ;
35
34
}
36
35
}
You can’t perform that action at this time.
0 commit comments