-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShowWeapon.cs
54 lines (52 loc) · 1.22 KB
/
ShowWeapon.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
51
52
53
54
using UnityEngine;
using System.Collections;
public class ShowWeapon : MonoBehaviour
{
[SerializeField]
public GameObject item1;
[SerializeField]
public GameObject item2;
public bool showItem1;
public bool showItem2;
// Use this for initialization
void Start()
{
showItem1 = false;
showItem2 = false;
}
// Update is called once per frame
void Update()
{
if (showItem1 == false)
{
item1.SetActive(false);
}
if (showItem1 == true)
{
item1.SetActive(true);
}
if (showItem2 == false)
{
item2.SetActive(false);
}
if (showItem2 == true)
{
item2.SetActive(true);
}
if (Input.GetKeyDown(KeyCode.Alpha1) && showItem1 == false)
{
showItem1 = true;
showItem2 = false;
}
if(Input.GetKeyDown(KeyCode.Alpha2)&& showItem2 == false)
{
showItem2 = true;
showItem1 = false;
}
if (Input.GetKeyDown(KeyCode.R))
{
showItem2 = false;
showItem1 = false;
}
}
}