Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
tetra-tower
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Oenos
tetra-tower
Commits
40cfe404
Commit
40cfe404
authored
Jan 30, 2019
by
18류지석
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
아이템 이제 떨굼. 지금 인벤토리 키고 끄는게 없어서 인스펙터에서 직접 키고 꺼야함
parent
a4590655
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
InventoryManager.cs
Assets/Scripts/Item/InventoryManager.cs
+31
-9
No files found.
Assets/Scripts/Item/InventoryManager.cs
View file @
40cfe404
...
@@ -10,11 +10,14 @@ public class InventoryManager : MonoBehaviour {
...
@@ -10,11 +10,14 @@ public class InventoryManager : MonoBehaviour {
public
List
<
string
>
itemPool
=
new
List
<
string
>();
public
List
<
string
>
itemPool
=
new
List
<
string
>();
public
List
<
string
>
addonPool
=
new
List
<
string
>();
public
List
<
string
>
addonPool
=
new
List
<
string
>();
public
GameObject
droppedPrefab
;
public
GameObject
droppedPrefab
;
GameObject
player
;
private
void
Start
()
private
void
Start
()
{
{
ui
=
GameObject
.
Find
(
"InventoryCanvas"
).
GetComponent
<
InventoryUI
>();
ui
=
GameObject
.
Find
(
"InventoryCanvas"
).
GetComponent
<
InventoryUI
>();
//GameObject.Find("InventoryCanvas").SetActive(false);
GameObject
.
Find
(
"InventoryCanvas"
).
SetActive
(
false
);
player
=
GameObject
.
Find
(
"Player"
);
//itemPool
//itemPool
itemPool
.
Add
(
"Baculus"
);
itemPool
.
Add
(
"Baculus"
);
...
@@ -37,17 +40,17 @@ public class InventoryManager : MonoBehaviour {
...
@@ -37,17 +40,17 @@ public class InventoryManager : MonoBehaviour {
PushItem
((
Item
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
itemPool
[
0
])));
PushItem
((
Item
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
itemPool
[
0
])));
PushItem
((
Item
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
itemPool
[
2
])));
PushItem
((
Item
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
itemPool
[
2
])));
yield
return
new
WaitForSeconds
(
1.5f
);
yield
return
new
WaitForSeconds
(
1.5f
);
ItemInstantiate
(
itemPool
[
0
],
GameObject
.
Find
(
"Player"
)
.
transform
.
position
);
ItemInstantiate
(
itemPool
[
0
],
player
.
transform
.
position
);
yield
return
new
WaitForSeconds
(
1.5f
);
yield
return
new
WaitForSeconds
(
1.5f
);
ItemInstantiate
(
itemPool
[
1
],
GameObject
.
Find
(
"Player"
)
.
transform
.
position
);
ItemInstantiate
(
itemPool
[
1
],
player
.
transform
.
position
);
yield
return
new
WaitForSeconds
(
1.5f
);
yield
return
new
WaitForSeconds
(
1.5f
);
ItemInstantiate
(
itemPool
[
2
],
GameObject
.
Find
(
"Player"
)
.
transform
.
position
);
ItemInstantiate
(
itemPool
[
2
],
player
.
transform
.
position
);
yield
return
new
WaitForSeconds
(
1.5f
);
yield
return
new
WaitForSeconds
(
1.5f
);
ItemInstantiate
(
itemPool
[
3
],
GameObject
.
Find
(
"Player"
)
.
transform
.
position
);
ItemInstantiate
(
itemPool
[
3
],
player
.
transform
.
position
);
yield
return
new
WaitForSeconds
(
1.5f
);
yield
return
new
WaitForSeconds
(
1.5f
);
AddonInstantiate
(
addonPool
[
0
],
GameObject
.
Find
(
"Player"
)
.
transform
.
position
);
AddonInstantiate
(
addonPool
[
0
],
player
.
transform
.
position
);
yield
return
new
WaitForSeconds
(
1.5f
);
yield
return
new
WaitForSeconds
(
1.5f
);
AddonInstantiate
(
addonPool
[
1
],
GameObject
.
Find
(
"Player"
)
.
transform
.
position
);
AddonInstantiate
(
addonPool
[
1
],
player
.
transform
.
position
);
/*ItemSelect(0);
/*ItemSelect(0);
yield return new WaitForSeconds(1f);
yield return new WaitForSeconds(1f);
PushItem((Item)System.Activator.CreateInstance(System.Type.GetType(itemPool[1])));
PushItem((Item)System.Activator.CreateInstance(System.Type.GetType(itemPool[1])));
...
@@ -67,11 +70,21 @@ public class InventoryManager : MonoBehaviour {
...
@@ -67,11 +70,21 @@ public class InventoryManager : MonoBehaviour {
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
((
Item
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
str
)),
pos
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
((
Item
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
str
)),
pos
);
}
}
public
void
ItemInstantiate
(
Item
item
,
Vector3
pos
)
{
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
(
item
,
pos
);
}
public
void
AddonInstantiate
(
string
str
,
Vector3
pos
)
public
void
AddonInstantiate
(
string
str
,
Vector3
pos
)
{
{
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
((
Addon
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
str
)),
pos
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
((
Addon
)
System
.
Activator
.
CreateInstance
(
System
.
Type
.
GetType
(
str
)),
pos
);
}
}
public
void
AddonInstantiate
(
Addon
addon
,
Vector3
pos
)
{
GameObject
tmpItem
=
Instantiate
(
droppedPrefab
);
tmpItem
.
GetComponent
<
DroppedItem
>().
Init
(
addon
,
pos
);
}
public
void
SetOnPosition
()
public
void
SetOnPosition
()
{
{
ui
.
SetOnPosition
(
itemList
,
addonList
);
ui
.
SetOnPosition
(
itemList
,
addonList
);
...
@@ -106,21 +119,30 @@ public class InventoryManager : MonoBehaviour {
...
@@ -106,21 +119,30 @@ public class InventoryManager : MonoBehaviour {
public
void
DiscardItem
(
int
index
)
public
void
DiscardItem
(
int
index
)
{
{
if
(
itemList
.
Count
>
index
)
if
(
itemList
.
Count
>
index
)
{
ItemInstantiate
(
itemList
[
index
],
player
.
transform
.
position
);
itemList
.
RemoveAt
(
index
);
itemList
.
RemoveAt
(
index
);
if
(
index
==
ui
.
selectedItem
)
if
(
index
==
ui
.
selectedItem
)
ui
.
selectedItem
=
-
1
;
ui
.
selectedItem
=
-
1
;
}
ui
.
SetOnPosition
(
itemList
,
addonList
);
ui
.
SetOnPosition
(
itemList
,
addonList
);
}
}
public
void
DiscardAddon
(
int
index
)
public
void
DiscardAddon
(
int
index
)
{
{
if
(
addonList
.
Count
>
index
)
if
(
addonList
.
Count
>
index
)
{
AddonInstantiate
(
addonList
[
index
],
player
.
transform
.
position
);
addonList
.
RemoveAt
(
index
);
addonList
.
RemoveAt
(
index
);
}
ui
.
SetOnPosition
(
itemList
,
addonList
);
ui
.
SetOnPosition
(
itemList
,
addonList
);
}
}
public
void
DiscardAddon
(
int
itemIndex
,
AddonType
addonType
)
public
void
DiscardAddon
(
int
itemIndex
,
AddonType
addonType
)
{
{
if
(
itemList
[
itemIndex
].
addons
[(
int
)
addonType
]
!=
null
)
if
(
itemList
[
itemIndex
].
addons
[(
int
)
addonType
]
!=
null
)
{
AddonInstantiate
(
itemList
[
itemIndex
].
addons
[(
int
)
addonType
],
player
.
transform
.
position
);
itemList
[
itemIndex
].
addons
[(
int
)
addonType
]
=
null
;
itemList
[
itemIndex
].
addons
[(
int
)
addonType
]
=
null
;
}
ui
.
SetOnPosition
(
itemList
,
addonList
);
ui
.
SetOnPosition
(
itemList
,
addonList
);
}
}
public
void
AttachAddon
(
int
itemIndex
,
int
addonIndex
)
public
void
AttachAddon
(
int
itemIndex
,
int
addonIndex
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment