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
5b9ffe20
Commit
5b9ffe20
authored
Feb 25, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
이제 상점 제대로 작동함. 상점 아이템은 이제 가격을 띄움
parent
3b2061fb
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
296 additions
and
50 deletions
+296
-50
InventoryManager.prefab
...Prefabs/UI/In-Game UI/InventoryUI/InventoryManager.prefab
+3
-0
Price.prefab
Assets/Prefabs/UI/Price.prefab
+90
-0
Price.prefab.meta
Assets/Prefabs/UI/Price.prefab.meta
+8
-0
PriceCanvas.prefab
Assets/Prefabs/UI/PriceCanvas.prefab
+106
-0
PriceCanvas.prefab.meta
Assets/Prefabs/UI/PriceCanvas.prefab.meta
+8
-0
EffectManager.cs
Assets/Scripts/EffectManager.cs
+0
-1
DroppedItem.cs
Assets/Scripts/Item/DroppedItem.cs
+2
-2
IPlayerInteraction.cs
Assets/Scripts/Item/IPlayerInteraction.cs
+1
-0
InventoryManager.cs
Assets/Scripts/Item/InventoryManager.cs
+21
-9
GoldRoomInGame.cs
Assets/Scripts/TetrisMap/Rooms/GoldRoomInGame.cs
+7
-26
DroppedLifeStone.cs
...Scripts/UI/In-game UI/LifeStoneScript/DroppedLifeStone.cs
+2
-3
DroppedObject.cs
...ts/Scripts/UI/In-game UI/LifeStoneScript/DroppedObject.cs
+11
-0
DroppedObject.cs.meta
...ripts/UI/In-game UI/LifeStoneScript/DroppedObject.cs.meta
+11
-0
DroppedPotion.cs
...ts/Scripts/UI/In-game UI/LifeStoneScript/DroppedPotion.cs
+2
-1
LifeStoneManager.cs
...Scripts/UI/In-game UI/LifeStoneScript/LifeStoneManager.cs
+24
-8
No files found.
Assets/Prefabs/UI/In-Game UI/InventoryUI/InventoryManager.prefab
View file @
5b9ffe20
...
...
@@ -55,3 +55,6 @@ MonoBehaviour:
type
:
2
}
popoutStrengthMultiplier
:
9
popoutTime
:
0.1
priceCanvas
:
{
fileID
:
1326064071694500
,
guid
:
51286afce3c9c8a4bae74feddf8b13af
,
type
:
2
}
price
:
{
fileID
:
114275555228777956
,
guid
:
4ec53eab8ea50de4ea5b9ff658d83ca0
,
type
:
2
}
Assets/Prefabs/UI/Price.prefab
0 → 100644
View file @
5b9ffe20
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!1001
&100100000
Prefab
:
m_ObjectHideFlags
:
1
serializedVersion
:
2
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
[]
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
0
}
m_RootGameObject
:
{
fileID
:
1315709384020204
}
m_IsPrefabAsset
:
1
---
!u!1
&1315709384020204
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
224463872583268090
}
-
component
:
{
fileID
:
222313814646567910
}
-
component
:
{
fileID
:
114275555228777956
}
m_Layer
:
0
m_Name
:
Price
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&114275555228777956
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1315709384020204
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
708705254
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
0
,
g
:
0
,
b
:
0
,
a
:
1
}
m_RaycastTarget
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData
:
m_Font
:
{
fileID
:
10102
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_FontSize
:
1
m_FontStyle
:
0
m_BestFit
:
0
m_MinSize
:
0
m_MaxSize
:
100
m_Alignment
:
4
m_AlignByGeometry
:
0
m_RichText
:
1
m_HorizontalOverflow
:
0
m_VerticalOverflow
:
0
m_LineSpacing
:
1
m_Text
:
'
0
'
---
!u!222
&222313814646567910
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1315709384020204
}
m_CullTransparentMesh
:
0
---
!u!224
&224463872583268090
RectTransform
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1315709384020204
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
0.5
,
y
:
0.5
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
-924
,
y
:
-528
}
m_SizeDelta
:
{
x
:
100
,
y
:
100
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
Assets/Prefabs/UI/Price.prefab.meta
0 → 100644
View file @
5b9ffe20
fileFormatVersion: 2
guid: 4ec53eab8ea50de4ea5b9ff658d83ca0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
Assets/Prefabs/UI/PriceCanvas.prefab
0 → 100644
View file @
5b9ffe20
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!1001
&100100000
Prefab
:
m_ObjectHideFlags
:
1
serializedVersion
:
2
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
[]
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
0
}
m_RootGameObject
:
{
fileID
:
1326064071694500
}
m_IsPrefabAsset
:
1
---
!u!1
&1326064071694500
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
224453801227078434
}
-
component
:
{
fileID
:
223566371550133596
}
-
component
:
{
fileID
:
114428697731747914
}
-
component
:
{
fileID
:
114817208632956030
}
m_Layer
:
5
m_Name
:
PriceCanvas
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&114428697731747914
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1326064071694500
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
1980459831
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_UiScaleMode
:
0
m_ReferencePixelsPerUnit
:
100
m_ScaleFactor
:
1
m_ReferenceResolution
:
{
x
:
800
,
y
:
600
}
m_ScreenMatchMode
:
0
m_MatchWidthOrHeight
:
0
m_PhysicalUnit
:
3
m_FallbackScreenDPI
:
96
m_DefaultSpriteDPI
:
96
m_DynamicPixelsPerUnit
:
50
---
!u!114
&114817208632956030
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1326064071694500
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
1301386320
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_IgnoreReversedGraphics
:
1
m_BlockingObjects
:
0
m_BlockingMask
:
serializedVersion
:
2
m_Bits
:
4294967295
---
!u!223
&223566371550133596
Canvas
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1326064071694500
}
m_Enabled
:
1
serializedVersion
:
3
m_RenderMode
:
2
m_Camera
:
{
fileID
:
0
}
m_PlaneDistance
:
100
m_PixelPerfect
:
0
m_ReceivesEvents
:
1
m_OverrideSorting
:
0
m_OverridePixelPerfect
:
0
m_SortingBucketNormalizedSize
:
0
m_AdditionalShaderChannelsFlag
:
0
m_SortingLayerID
:
-1453652901
m_SortingOrder
:
0
m_TargetDisplay
:
0
---
!u!224
&224453801227078434
RectTransform
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1326064071694500
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
m_AnchorMax
:
{
x
:
0
,
y
:
0
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
Assets/Prefabs/UI/PriceCanvas.prefab.meta
0 → 100644
View file @
5b9ffe20
fileFormatVersion: 2
guid: 51286afce3c9c8a4bae74feddf8b13af
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/EffectManager.cs
View file @
5b9ffe20
...
...
@@ -17,7 +17,6 @@ public class EffectManager : Singleton<EffectManager> {
effectArray
[
i
]
=
Instantiate
(
effectPrefab
,
transform
);
effectArray
[
i
].
SetActive
(
false
);
}
}
public
bool
StartEffect
(
int
type
,
Bounds
bound1
,
Bounds
bound2
)
...
...
Assets/Scripts/Item/DroppedItem.cs
View file @
5b9ffe20
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
DroppedItem
:
MonoBehaviour
,
IPlayerInteraction
public
class
DroppedItem
:
DroppedObject
,
IPlayerInteraction
{
InventoryManager
inventoryManager
;
public
bool
itemAddon
;
//false: item true: addon
...
...
@@ -13,7 +14,6 @@ public class DroppedItem : MonoBehaviour, IPlayerInteraction
Rigidbody2D
rb2D
;
BoxCollider2D
bc2D
;
SpriteRenderer
sprt
;
public
int
price
=
0
;
public
void
Init
(
Item
_item
,
Vector3
pos
)
{
inventoryManager
=
GameObject
.
Find
(
"InventoryManager"
).
GetComponent
<
InventoryManager
>();
...
...
Assets/Scripts/Item/IPlayerInteraction.cs
View file @
5b9ffe20
...
...
@@ -4,6 +4,7 @@ using UnityEngine;
public
interface
IPlayerInteraction
{
void
HighlightSwitch
(
bool
enabled
);
void
Apply
();
}
Assets/Scripts/Item/InventoryManager.cs
View file @
5b9ffe20
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
InventoryManager
:
Singleton
<
InventoryManager
>
{
...
...
@@ -12,12 +13,15 @@ public class InventoryManager : Singleton<InventoryManager> {
public
GameObject
droppedPrefab
;
public
float
popoutStrengthMultiplier
;
public
float
popoutTime
;
public
GameObject
priceCanvas
;
public
Text
price
;
GameObject
player
;
private
void
Start
()
{
ui
=
GameObject
.
Find
(
"InventoryCanvas"
).
GetComponent
<
InventoryUI
>();
GameObject
.
Find
(
"InventoryCanvas"
).
SetActive
(
false
);
priceCanvas
=
Instantiate
(
priceCanvas
);
player
=
GameObject
.
Find
(
"Player"
);
...
...
@@ -128,12 +132,13 @@ public class InventoryManager : Singleton<InventoryManager> {
/// <param name="quality"></param>
/// <param name="pos"></param>
/// <param name="popoutStrength">0:no popout, 1:normal popout</param>
public
void
ItemInstantiate
(
ItemQuality
quality
,
Vector3
pos
,
float
popoutStrength
)
public
GameObject
ItemInstantiate
(
ItemQuality
quality
,
Vector3
pos
,
float
popoutStrength
)
{
if
(
itemPool
[(
int
)
quality
].
Count
>
0
)
{
ItemInstantiate
(
itemPool
[(
int
)
quality
][
0
],
pos
,
popoutStrength
);
return
ItemInstantiate
(
itemPool
[(
int
)
quality
][
0
],
pos
,
popoutStrength
);
}
return
null
;
}
/// <summary>
/// Instantiate item by name on pos, also Instantiate Item class
...
...
@@ -173,14 +178,16 @@ public class InventoryManager : Singleton<InventoryManager> {
/// <param name="pos"></param>
/// <param name="price"></param>
/// <param name="popoutStrength">0:no popout, 1:normal popout</param>
public
void
ItemInstantiate
(
ItemQuality
quality
,
Vector3
pos
,
int
price
,
float
popoutStrength
)
public
GameObject
ItemInstantiate
(
ItemQuality
quality
,
Vector3
pos
,
int
_
price
,
float
popoutStrength
)
{
if
(
itemPool
[(
int
)
quality
].
Count
>
0
)
{
GameObject
tmpItem
=
ItemInstantiate
(
itemPool
[(
int
)
quality
][
0
],
pos
,
popoutStrength
);
tmpItem
.
GetComponent
<
DroppedItem
>().
price
=
price
;
tmpItem
.
GetComponent
<
DroppedObject
>().
price
=
_price
;
tmpItem
.
GetComponent
<
DroppedObject
>().
priceTag
=
Instantiate
(
price
,
new
Vector3
(
0
,
0
,
0
),
Quaternion
.
identity
,
priceCanvas
.
transform
);
return
tmpItem
;
}
return
null
;
}
/// <summary>
...
...
@@ -188,12 +195,14 @@ public class InventoryManager : Singleton<InventoryManager> {
/// </summary>
/// <param name="quality"></param>
/// <param name="pos"></param>
public
void
AddonInstantiate
(
ItemQuality
quality
,
Vector3
pos
,
float
popoutStrength
)
public
GameObject
AddonInstantiate
(
ItemQuality
quality
,
Vector3
pos
,
float
popoutStrength
)
{
if
(
addonPool
[(
int
)
quality
].
Count
>
0
)
{
AddonInstantiate
(
addonPool
[(
int
)
quality
][
0
],
pos
,
popoutStrength
);
GameObject
tmpItem
=
AddonInstantiate
(
addonPool
[(
int
)
quality
][
0
],
pos
,
popoutStrength
);
return
tmpItem
;
}
return
null
;
}
/// <summary>
/// Instantiate addon by name on pos, also Instantiate Addon class
...
...
@@ -234,13 +243,16 @@ public class InventoryManager : Singleton<InventoryManager> {
/// <param name="price">The price.</param>
/// <param name="popoutStrength">The popout strength.</param>
/// <returns></returns>
public
void
AddonInstantiate
(
ItemQuality
quality
,
Vector3
pos
,
int
price
,
float
popoutStrength
)
public
GameObject
AddonInstantiate
(
ItemQuality
quality
,
Vector3
pos
,
int
_
price
,
float
popoutStrength
)
{
if
(
addonPool
[(
int
)
quality
].
Count
>
0
)
{
GameObject
tmpItem
=
AddonInstantiate
(
addonPool
[(
int
)
quality
][
0
],
pos
,
popoutStrength
);
tmpItem
.
GetComponent
<
DroppedItem
>().
price
=
price
;
tmpItem
.
GetComponent
<
DroppedObject
>().
price
=
_price
;
tmpItem
.
GetComponent
<
DroppedObject
>().
priceTag
=
Instantiate
(
price
,
new
Vector3
(
0
,
0
,
0
),
Quaternion
.
identity
,
priceCanvas
.
transform
);
return
tmpItem
;
}
return
null
;
}
/// <summary>
...
...
Assets/Scripts/TetrisMap/Rooms/GoldRoomInGame.cs
View file @
5b9ffe20
...
...
@@ -2,7 +2,6 @@
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
GoldRoomItemInfo
{
public
ItemSpawnType
[]
itemType
;
...
...
@@ -79,38 +78,20 @@ public class GoldRoomInGame : RoomInGame {
for
(
int
i
=
0
;
i
<
itemInfo
.
itemType
.
Length
;
i
++)
{
if
(
itemInfo
.
itemType
[
i
]
==
ItemSpawnType
.
Item
)
{
Debug
.
Log
(
"type"
+
itemInfo
.
itemType
[
i
]
+
" quality"
+
itemInfo
.
itemQuality
[
i
]
+
" price"
+
itemInfo
.
price
[
i
]);
inventoryManager
.
ItemInstantiate
(
itemInfo
.
itemQuality
[
i
],
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
Debug
.
Log
(
"done"
);
}
itemGoods
[
i
]
=
inventoryManager
.
ItemInstantiate
(
itemInfo
.
itemQuality
[
i
],
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
else
if
(
itemInfo
.
itemType
[
i
]
==
ItemSpawnType
.
Addon
)
{
Debug
.
Log
(
"type"
+
itemInfo
.
itemType
[
i
]
+
" quality"
+
itemInfo
.
itemQuality
[
i
]
+
" price"
+
itemInfo
.
price
[
i
]);
inventoryManager
.
AddonInstantiate
(
itemInfo
.
itemQuality
[
i
],
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
Debug
.
Log
(
"done"
);
}
itemGoods
[
i
]
=
inventoryManager
.
AddonInstantiate
(
itemInfo
.
itemQuality
[
i
],
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
else
if
(
itemInfo
.
itemType
[
i
]
==
ItemSpawnType
.
GoldPotion
)
{
Debug
.
Log
(
"type"
+
itemInfo
.
itemType
[
i
]
+
" quality"
+
itemInfo
.
itemQuality
[
i
]
+
" price"
+
itemInfo
.
price
[
i
]);
lifeStoneManager
.
InstantiatePotion
(
itemPosition
[
itemCount
++],
0
);
Debug
.
Log
(
"done"
);
}
itemGoods
[
i
]
=
lifeStoneManager
.
InstantiatePotion
(
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
else
if
(
itemInfo
.
itemType
[
i
]
==
ItemSpawnType
.
LifeStone
)
{
if
(
itemInfo
.
itemQuality
[
i
]
==
ItemQuality
.
Gold
)
{
Debug
.
Log
(
"type"
+
itemInfo
.
itemType
[
i
]
+
" quality"
+
itemInfo
.
itemQuality
[
i
]
+
" price"
+
itemInfo
.
price
[
i
]);
lifeStoneManager
.
InstantiateDroppedLifeStone
(
new
Vector2Int
(
3
,
2
),
1
,
0
,
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
Debug
.
Log
(
"done"
);
}
itemGoods
[
i
]
=
lifeStoneManager
.
InstantiateDroppedLifeStone
(
new
Vector2Int
(
3
,
2
),
1
,
0
,
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
else
{
Debug
.
Log
(
"type"
+
itemInfo
.
itemType
[
i
]
+
" quality"
+
itemInfo
.
itemQuality
[
i
]
+
" price"
+
itemInfo
.
price
[
i
]);
lifeStoneManager
.
InstantiateDroppedLifeStone
(
new
Vector2Int
(
3
,
2
),
0
,
0
,
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
Debug
.
Log
(
"done"
);
}
itemGoods
[
i
]
=
lifeStoneManager
.
InstantiateDroppedLifeStone
(
new
Vector2Int
(
3
,
2
),
0
,
0
,
itemPosition
[
itemCount
++],
itemInfo
.
price
[
i
],
0
);
}
itemGoods
[
i
].
GetComponent
<
DroppedObject
>().
priceTag
.
transform
.
position
=
itemGoods
[
i
].
transform
.
position
+
new
Vector3
(
0
,
1
,
0
);
itemGoods
[
i
].
GetComponent
<
DroppedObject
>().
priceTag
.
text
=
itemInfo
.
price
[
i
].
ToString
();
}
}
...
...
Assets/Scripts/UI/In-game UI/LifeStoneScript/DroppedLifeStone.cs
View file @
5b9ffe20
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
DroppedLifeStone
:
MonoBehaviour
,
IPlayerInteraction
public
class
DroppedLifeStone
:
DroppedObject
,
IPlayerInteraction
{
LifeStoneInfo
info
;
public
Sprite
[]
sprites
;
...
...
@@ -19,8 +20,6 @@ public class DroppedLifeStone : MonoBehaviour, IPlayerInteraction
/// highlightSprite Objects
/// </summary>
GameObject
[]
highObj
;
public
int
price
=
0
;
public
void
Init
(
LifeStoneInfo
_info
,
Vector3
pos
)
{
info
=
_info
;
...
...
Assets/Scripts/UI/In-game UI/LifeStoneScript/DroppedObject.cs
0 → 100644
View file @
5b9ffe20
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
DroppedObject
:
MonoBehaviour
{
public
int
price
=
0
;
public
Text
priceTag
;
}
Assets/Scripts/UI/In-game UI/LifeStoneScript/DroppedObject.cs.meta
0 → 100644
View file @
5b9ffe20
fileFormatVersion: 2
guid: a9b3b784b69caa64fb2895231e7c5570
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/UI/In-game UI/LifeStoneScript/DroppedPotion.cs
View file @
5b9ffe20
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
public
class
DroppedPotion
:
MonoBehaviour
,
IPlayerInteraction
{
public
class
DroppedPotion
:
DroppedObject
,
IPlayerInteraction
{
public
GameObject
highlight
;
...
...
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneManager.cs
View file @
5b9ffe20
...
...
@@ -87,9 +87,19 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
frameSuper
.
GetComponent
<
LifeStoneFrame
>().
AddRow
(
lifeStoneRowNum
);
}
public
void
InstantiatePotion
(
Vector3
pos
,
float
popoutStrength
)
public
GameObject
InstantiatePotion
(
Vector3
pos
,
float
popoutStrength
)
{
PopoutGenerator
(
Instantiate
(
goldPotionPrefab
,
pos
,
Quaternion
.
identity
),
popoutStrength
);
GameObject
tmpPotion
=
Instantiate
(
goldPotionPrefab
,
pos
,
Quaternion
.
identity
);
PopoutGenerator
(
tmpPotion
,
popoutStrength
);
return
tmpPotion
;
}
public
GameObject
InstantiatePotion
(
Vector3
pos
,
int
_price
,
float
popoutStrength
)
{
GameObject
tmpPotion
=
Instantiate
(
goldPotionPrefab
,
pos
,
Quaternion
.
identity
);
PopoutGenerator
(
tmpPotion
,
popoutStrength
);
tmpPotion
.
GetComponent
<
DroppedObject
>().
price
=
_price
;
tmpPotion
.
GetComponent
<
DroppedObject
>().
priceTag
=
Instantiate
(
InventoryManager
.
Instance
.
price
,
new
Vector3
(
0
,
0
,
0
),
Quaternion
.
identity
,
InventoryManager
.
Instance
.
priceCanvas
.
transform
);
return
tmpPotion
;
}
IEnumerator
PopoutCoroutine
(
GameObject
obj
)
...
...
@@ -125,41 +135,47 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
/// </summary>
/// <param name="info"></param>
/// <param name="pos"></param>
public
void
InstantiateDroppedLifeStone
(
Vector2Int
size
,
int
num
,
float
goldPer
,
int
ameNum
,
Vector3
pos
,
float
popoutStrength
)
public
GameObject
InstantiateDroppedLifeStone
(
Vector2Int
size
,
int
num
,
float
goldPer
,
int
ameNum
,
Vector3
pos
,
float
popoutStrength
)
{
GameObject
tmpObj
=
Instantiate
(
droppedLifeStonePrefab
);
tmpObj
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
tmpObj
.
GetComponent
<
DroppedLifeStone
>().
Init
(
CreateLifeStoneInfo
(
size
,
num
,
goldPer
,
ameNum
),
pos
);
PopoutGenerator
(
tmpObj
,
popoutStrength
);
return
tmpObj
;
}
public
void
InstantiateDroppedLifeStone
(
Vector2Int
size
,
float
goldPer
,
int
ameNum
,
Vector3
pos
,
float
popoutStrength
)
public
GameObject
InstantiateDroppedLifeStone
(
Vector2Int
size
,
float
goldPer
,
int
ameNum
,
Vector3
pos
,
float
popoutStrength
)
{
GameObject
tmpObj
=
Instantiate
(
droppedLifeStonePrefab
);
tmpObj
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
tmpObj
.
GetComponent
<
DroppedLifeStone
>().
Init
(
CreateLifeStoneInfo
(
size
,
goldPer
,
ameNum
),
pos
);
PopoutGenerator
(
tmpObj
,
popoutStrength
);
return
tmpObj
;
}
public
void
InstantiateDroppedLifeStone
(
int
num
,
float
goldPer
,
int
ameNum
,
Vector3
pos
,
float
popoutStrength
)
public
GameObject
InstantiateDroppedLifeStone
(
int
num
,
float
goldPer
,
int
ameNum
,
Vector3
pos
,
float
popoutStrength
)
{
GameObject
tmpObj
=
Instantiate
(
droppedLifeStonePrefab
);
tmpObj
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
tmpObj
.
GetComponent
<
DroppedLifeStone
>().
Init
(
CreateLifeStoneInfo
(
num
,
goldPer
,
ameNum
),
pos
);
PopoutGenerator
(
tmpObj
,
popoutStrength
);
return
tmpObj
;
}
public
void
InstantiateDroppedLifeStone
(
LifeStoneInfo
info
,
Vector3
pos
,
float
popoutStrength
)
public
GameObject
InstantiateDroppedLifeStone
(
LifeStoneInfo
info
,
Vector3
pos
,
float
popoutStrength
)
{
GameObject
tmpObj
=
Instantiate
(
droppedLifeStonePrefab
);
tmpObj
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
tmpObj
.
GetComponent
<
DroppedLifeStone
>().
Init
(
info
,
pos
);
PopoutGenerator
(
tmpObj
,
popoutStrength
);
return
tmpObj
;
}
public
void
InstantiateDroppedLifeStone
(
Vector2Int
size
,
float
goldPer
,
int
ameNum
,
Vector3
pos
,
int
price
,
float
popoutStrength
)
public
GameObject
InstantiateDroppedLifeStone
(
Vector2Int
size
,
float
goldPer
,
int
ameNum
,
Vector3
pos
,
int
_
price
,
float
popoutStrength
)
{
GameObject
tmpObj
=
Instantiate
(
droppedLifeStonePrefab
);
tmpObj
.
transform
.
SetParent
(
MapManager
.
currentRoom
.
roomInGame
.
transform
);
tmpObj
.
GetComponent
<
DroppedLifeStone
>().
Init
(
CreateLifeStoneInfo
(
size
,
goldPer
,
ameNum
),
pos
);
PopoutGenerator
(
tmpObj
,
popoutStrength
);
tmpObj
.
GetComponent
<
DroppedLifeStone
>().
price
=
price
;
tmpObj
.
GetComponent
<
DroppedObject
>().
price
=
_price
;
tmpObj
.
GetComponent
<
DroppedObject
>().
priceTag
=
Instantiate
(
InventoryManager
.
Instance
.
price
,
new
Vector3
(
0
,
0
,
0
),
Quaternion
.
identity
,
InventoryManager
.
Instance
.
priceCanvas
.
transform
);
return
tmpObj
;
}
/// <summary>
...
...
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