-
Notifications
You must be signed in to change notification settings - Fork 0
/
ItemHandlerScript
99 lines (90 loc) · 2.08 KB
/
ItemHandlerScript
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class itemHandler : MonoBehaviour
{
public movementController mC;
public AttackScript aS;
public GameObject Satchel;
public GameObject Sword;
public bool swordObtained;
public bool overRideSO;
bool showSword;
public bool satchelObtained;
bool showSatchel;
void Start()
{
swordObtained = false;
satchelObtained = false;
if (overRideSO)
{
swordObtained = true;
satchelObtained = true;
}
}
void Update()
{
SwordController();
SatchelController();
showItemsOrNah();
}
void SwordController()
{
if (swordObtained)
{
if (mC.showItems)
{
//Hvis man har fået sværdet og det må vise sig, bliver det vist. Når man er igang med at svinge det, forsvinder det fra johnnys ryg.
if (aS.striking)
{
showSword = false;
}
if (!aS.striking)
{
showSword = true;
}
}
else
{
showSword = false;
}
}
else
{
showSword = false;
}
}
void SatchelController()
{
if (satchelObtained)
{
//Hvis man har samlet posen op, og den gerne må vises, så bliver den vist.
if (mC.showItems)
{
showSatchel = true;
}
else
{
showSatchel = false;
}
}
else
{
showSatchel = false;
}
}
void showItemsOrNah()
{
//Får items til at vise sig, hvis de må vises
if (showSword)
{
Sword.SetActive(true);
}
else { Sword.SetActive(false); }
if (showSatchel)
{
Satchel.SetActive(true);
}
else { Satchel.SetActive(false); }
}
}