-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathInventoryTutorialState.cs
50 lines (43 loc) · 1.41 KB
/
InventoryTutorialState.cs
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
using UnityEngine;
using System.Collections;
namespace UnityCheatSheet.Patterns.StatePattern.States
{
public class InventoryTutorialState : IState
{
private readonly OnboardingManager manager;
private bool inventoryOpened = false;
private bool itemSelected = false;
public InventoryTutorialState(OnboardingManager manager)
{
this.manager = manager;
}
public void Enter()
{
Debug.Log("Let's learn about inventory management! Press 'I' to open inventory.");
}
public void Update()
{
if (Input.GetKeyDown(KeyCode.I))
{
inventoryOpened = true;
Debug.Log("Inventory opened! Try selecting the Health Potion.");
}
// Simulated item selection (press Space to simulate selecting the item)
if (inventoryOpened && Input.GetKeyDown(KeyCode.Space))
{
itemSelected = true;
Debug.Log("Perfect! You've completed the basic tutorials!");
manager.StartCoroutine(CompleteOnboarding());
}
}
public void Exit()
{
Debug.Log("Inventory tutorial completed!");
}
private IEnumerator CompleteOnboarding()
{
yield return new WaitForSeconds(3f);
manager.CompleteOnboarding();
}
}
}