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
aacb5038
Commit
aacb5038
authored
Jan 13, 2019
by
18류지석
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
생명석 완성. 플레이어와의 상호작용은 함수만 구현함.
parent
b62bd7d5
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
4717 additions
and
41 deletions
+4717
-41
DroppedLifeUnitPrefab.prefab
.../UI/In-Game UI/LifeCrystalUI/DroppedLifeUnitPrefab.prefab
+4
-1
LifeUnitHighlight.prefab
...fabs/UI/In-Game UI/LifeCrystalUI/LifeUnitHighlight.prefab
+1
-1
LifeUnitSprite.prefab
...Prefabs/UI/In-Game UI/LifeCrystalUI/LifeUnitSprite.prefab
+1
-1
LifeStoneScene.unity
Assets/Scenes/LifeStoneScene.unity
+4469
-0
LifeStoneScene.unity.meta
Assets/Scenes/LifeStoneScene.unity.meta
+7
-0
DroppedLifeStone.cs
...Scripts/UI/In-game UI/LifeStoneScript/DroppedLifeStone.cs
+22
-5
LifeStoneFrame.cs
...s/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneFrame.cs
+61
-14
LifeStoneInfo.cs
...ts/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneInfo.cs
+1
-1
LifeStoneManager.cs
...Scripts/UI/In-game UI/LifeStoneScript/LifeStoneManager.cs
+92
-13
LifeStoneTest.cs
...ts/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneTest.cs
+43
-0
LifeStoneTest.cs.meta
...ripts/UI/In-game UI/LifeStoneScript/LifeStoneTest.cs.meta
+11
-0
LifeUnitInFrame.cs
.../Scripts/UI/In-game UI/LifeStoneScript/LifeUnitInFrame.cs
+3
-3
Physics2DSettings.asset
ProjectSettings/Physics2DSettings.asset
+1
-1
TagManager.asset
ProjectSettings/TagManager.asset
+1
-1
No files found.
Assets/Prefabs/UI/In-Game UI/LifeCrystalUI/DroppedLifeUnitPrefab.prefab
View file @
aacb5038
...
@@ -22,7 +22,7 @@ GameObject:
...
@@ -22,7 +22,7 @@ GameObject:
-
component
:
{
fileID
:
50720349360822072
}
-
component
:
{
fileID
:
50720349360822072
}
-
component
:
{
fileID
:
61973677923814376
}
-
component
:
{
fileID
:
61973677923814376
}
-
component
:
{
fileID
:
114071444104977984
}
-
component
:
{
fileID
:
114071444104977984
}
m_Layer
:
0
m_Layer
:
13
m_Name
:
DroppedLifeUnitPrefab
m_Name
:
DroppedLifeUnitPrefab
m_TagString
:
Untagged
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
...
@@ -105,3 +105,6 @@ MonoBehaviour:
...
@@ -105,3 +105,6 @@ MonoBehaviour:
unitSprite
:
{
fileID
:
1440159976580912
,
guid
:
672b38cc92ccf35439b6137b951daf15
,
type
:
2
}
unitSprite
:
{
fileID
:
1440159976580912
,
guid
:
672b38cc92ccf35439b6137b951daf15
,
type
:
2
}
highlightSprite
:
{
fileID
:
1638220072418960
,
guid
:
e279edc92751d234782d0cc881edfe87
,
highlightSprite
:
{
fileID
:
1638220072418960
,
guid
:
e279edc92751d234782d0cc881edfe87
,
type
:
2
}
type
:
2
}
playerLayer
:
serializedVersion
:
2
m_Bits
:
0
Assets/Prefabs/UI/In-Game UI/LifeCrystalUI/LifeUnitHighlight.prefab
View file @
aacb5038
...
@@ -20,7 +20,7 @@ GameObject:
...
@@ -20,7 +20,7 @@ GameObject:
m_Component
:
m_Component
:
-
component
:
{
fileID
:
4652270508485928
}
-
component
:
{
fileID
:
4652270508485928
}
-
component
:
{
fileID
:
212024161364399972
}
-
component
:
{
fileID
:
212024161364399972
}
m_Layer
:
14
m_Layer
:
0
m_Name
:
LifeUnitHighlight
m_Name
:
LifeUnitHighlight
m_TagString
:
Untagged
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
...
...
Assets/Prefabs/UI/In-Game UI/LifeCrystalUI/LifeUnitSprite.prefab
View file @
aacb5038
...
@@ -20,7 +20,7 @@ GameObject:
...
@@ -20,7 +20,7 @@ GameObject:
m_Component
:
m_Component
:
-
component
:
{
fileID
:
4153958457646730
}
-
component
:
{
fileID
:
4153958457646730
}
-
component
:
{
fileID
:
212455254602000724
}
-
component
:
{
fileID
:
212455254602000724
}
m_Layer
:
13
m_Layer
:
0
m_Name
:
LifeUnitSprite
m_Name
:
LifeUnitSprite
m_TagString
:
Untagged
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
...
...
Assets/Scenes/LifeStoneScene.unity
0 → 100644
View file @
aacb5038
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Assets/Scenes/LifeStoneScene.unity.meta
0 → 100644
View file @
aacb5038
fileFormatVersion: 2
guid: 2cda990e2423bbf4892e6590ba056729
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/UI/In-game UI/LifeStoneScript/DroppedLifeStone.cs
View file @
aacb5038
...
@@ -2,10 +2,12 @@
...
@@ -2,10 +2,12 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine
;
public
class
DroppedLifeStone
:
MonoBehaviour
{
public
class
DroppedLifeStone
:
MonoBehaviour
{
LifeStoneInfo
info
;
LifeStoneInfo
info
;
public
Sprite
[]
sprites
;
public
Sprite
[]
sprites
;
public
GameObject
unitSprite
,
highlightSprite
;
public
GameObject
unitSprite
,
highlightSprite
;
public
LayerMask
playerLayer
;
float
unitSize
;
float
unitSize
;
Rigidbody2D
rb2D
;
Rigidbody2D
rb2D
;
BoxCollider2D
bc2D
;
BoxCollider2D
bc2D
;
...
@@ -32,9 +34,10 @@ public class DroppedLifeStone : MonoBehaviour {
...
@@ -32,9 +34,10 @@ public class DroppedLifeStone : MonoBehaviour {
transform
.
position
=
pos
-
new
Vector3
(
inSize
.
x
*
unitSize
,
0
,
0
);
transform
.
position
=
pos
-
new
Vector3
(
inSize
.
x
*
unitSize
,
0
,
0
);
for
(
int
i
=
0
;
i
<
inSize
.
x
*
inSize
.
y
;
i
++)
for
(
int
i
=
0
;
i
<
inSize
.
x
*
inSize
.
y
;
i
++)
{
{
if
(
inFill
[
i
]
!=
' '
)
{
if
(
inFill
[
i
]
!=
' '
)
{
unitObj
[
i
]
=
Instantiate
(
unitSprite
,
transform
);
unitObj
[
i
]
=
Instantiate
(
unitSprite
,
transform
);
unitObj
[
i
].
transform
.
localPosition
=
new
Vector3
((
i
%
inSize
.
x
)
*
unitSize
,
((
int
)(
i
/
inSize
.
x
))
*
unitSize
,
0
);
unitObj
[
i
].
transform
.
localPosition
=
new
Vector3
((
i
%
inSize
.
x
)
*
unitSize
,
((
int
)(
i
/
inSize
.
x
))
*
unitSize
,
0
);
unitObj
[
i
].
GetComponent
<
SpriteRenderer
>().
sprite
=
sprites
[
inFill
[
i
]
-
'A'
];
unitObj
[
i
].
GetComponent
<
SpriteRenderer
>().
sprite
=
sprites
[
inFill
[
i
]
-
'A'
];
...
@@ -47,5 +50,19 @@ public class DroppedLifeStone : MonoBehaviour {
...
@@ -47,5 +50,19 @@ public class DroppedLifeStone : MonoBehaviour {
bc2D
.
offset
=
new
Vector2
(
unitSize
*
inSize
.
x
/
2f
,
unitSize
*
inSize
.
y
/
2f
);
bc2D
.
offset
=
new
Vector2
(
unitSize
*
inSize
.
x
/
2f
,
unitSize
*
inSize
.
y
/
2f
);
bc2D
.
size
=
new
Vector2
(
unitSize
*
inSize
.
x
,
unitSize
*
inSize
.
y
);
bc2D
.
size
=
new
Vector2
(
unitSize
*
inSize
.
x
,
unitSize
*
inSize
.
y
);
}
}
public
void
ApplyLifeStone
()
}
{
GameObject
.
Find
(
"LifeStoneUI"
).
GetComponent
<
LifeStoneManager
>().
PushLifeStone
(
info
);
Destroy
(
gameObject
);
}
public
void
HighlightSwitch
(
bool
enabled
)
{
Vector2Int
inSize
=
info
.
getSize
();
string
inFill
=
info
.
getFill
();
for
(
int
i
=
0
;
i
<
inSize
.
x
*
inSize
.
y
;
i
++)
{
if
(
inFill
[
i
]
!=
' '
)
highObj
[
i
].
GetComponent
<
SpriteRenderer
>().
enabled
=
enabled
;
}
}
}
\ No newline at end of file
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneFrame.cs
View file @
aacb5038
...
@@ -28,35 +28,82 @@ public class LifeStoneFrame : MonoBehaviour {
...
@@ -28,35 +28,82 @@ public class LifeStoneFrame : MonoBehaviour {
/// The sprites
/// The sprites
/// </summary>
/// </summary>
Sprite
[]
sprites
;
Sprite
[]
sprites
;
float
frameBorder
;
public
LifeStoneFrame
(
Transform
superGO
,
GameObject
standardImage
,
int
lifeStoneRow
,
float
lifeStoneSize
,
Sprite
[]
_sprites
)
public
void
Init
(
Transform
superGO
,
GameObject
standardImage
,
int
lifeStoneRow
,
float
lifeStoneSize
,
Sprite
[]
_sprites
,
float
_frameBorder
)
{
{
frameBorder
=
_frameBorder
;
sprites
=
new
Sprite
[
_sprites
.
GetLength
(
0
)];
sprites
=
new
Sprite
[
_sprites
.
GetLength
(
0
)];
_sprites
.
CopyTo
(
sprites
,
0
);
_sprites
.
CopyTo
(
sprites
,
0
);
this
.
lifeStoneRow
=
lifeStoneRow
;
this
.
lifeStoneRow
=
lifeStoneRow
;
this
.
lifeStoneSize
=
lifeStoneSize
;
this
.
lifeStoneSize
=
lifeStoneSize
;
frameTop
=
Instantiate
(
standardImage
,
superGO
);
frameTop
.
name
=
"FrameTop"
;
frameTop
.
GetComponent
<
Image
>().
sprite
=
sprites
[
2
];
frameTop
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
lifeStoneSize
*
(
3f
+
frameBorder
*
2
),
lifeStoneSize
*
frameBorder
);
frameTop
.
transform
.
localPosition
=
new
Vector3
(
0
,
lifeStoneSize
*
(
frameBorder
+
lifeStoneRow
));
frameRows
=
new
GameObject
[
50
];
for
(
int
i
=
49
;
i
>=
lifeStoneRow
;
i
--)
{
frameRows
[
i
]
=
Instantiate
(
standardImage
,
superGO
);
frameRows
[
i
].
name
=
"FrameRow"
+
i
.
ToString
(
"D2"
);
frameRows
[
i
].
GetComponent
<
Image
>().
color
=
new
Color
(
255
,
255
,
255
,
0
);
frameRows
[
i
].
GetComponent
<
Image
>().
sprite
=
sprites
[
1
];
frameRows
[
i
].
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
lifeStoneSize
*
(
3f
+
frameBorder
*
2
),
lifeStoneSize
);
frameRows
[
i
].
transform
.
localPosition
=
new
Vector3
(
0
,
lifeStoneSize
*
(
frameBorder
+
lifeStoneRow
-
1
));
}
for
(
int
i
=
lifeStoneRow
-
1
;
i
>=
0
;
i
--)
{
frameRows
[
i
]
=
Instantiate
(
standardImage
,
superGO
);
frameRows
[
i
].
name
=
"FrameRow"
+
i
.
ToString
(
"D2"
);
frameRows
[
i
].
GetComponent
<
Image
>().
sprite
=
sprites
[
1
];
frameRows
[
i
].
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
lifeStoneSize
*
(
3f
+
frameBorder
*
2
),
lifeStoneSize
);
frameRows
[
i
].
transform
.
localPosition
=
new
Vector3
(
0
,
lifeStoneSize
*
(
frameBorder
+
i
));
}
frameBottom
=
Instantiate
(
standardImage
,
superGO
);
frameBottom
=
Instantiate
(
standardImage
,
superGO
);
frameBottom
.
name
=
"FrameBottom"
;
frameBottom
.
name
=
"FrameBottom"
;
frameBottom
.
GetComponent
<
Image
>().
sprite
=
sprites
[
0
];
frameBottom
.
GetComponent
<
Image
>().
sprite
=
sprites
[
0
];
frameBottom
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
lifeStoneSize
*
3.4f
,
lifeStoneSize
*
0.2f
);
frameBottom
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
lifeStoneSize
*
(
3f
+
frameBorder
*
2
),
lifeStoneSize
*
frameBorder
);
frameBottom
.
transform
.
localPosition
=
new
Vector3
(
0
,
0
);
frameBottom
.
transform
.
localPosition
=
new
Vector3
(
0
,
0
);
frameRows
=
new
GameObject
[
50
];
}
for
(
int
i
=
0
;
i
<
lifeStoneRow
;
i
++)
public
void
AddRow
(
int
afterRow
)
{
int
prevLifeStoneRow
=
lifeStoneRow
;
lifeStoneRow
=
afterRow
;
StartCoroutine
(
ExpandEnumerator
(
prevLifeStoneRow
,
lifeStoneRow
));
}
IEnumerator
ExpandEnumerator
(
int
prev
,
int
after
)
{
float
d
=
0
;
float
v
=
0
;
float
a
=
lifeStoneSize
*
0.02f
;
while
(
true
)
{
{
frameRows
[
i
]
=
Instantiate
(
standardImage
,
superGO
);
d
+=
v
;
frameRows
[
i
].
name
=
"FrameRow"
+
i
.
ToString
(
"D2"
);
v
+=
a
;
frameRows
[
i
].
GetComponent
<
Image
>().
sprite
=
sprites
[
1
];
if
(
d
>=
lifeStoneSize
*
(
after
-
prev
))
frameRows
[
i
].
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
lifeStoneSize
*
3.4f
,
lifeStoneSize
);
{
frameRows
[
i
].
transform
.
localPosition
=
new
Vector3
(
0
,
lifeStoneSize
*
(
0.2f
+
i
));
d
=
lifeStoneSize
*
(
after
-
prev
);
a
=
0
;
}
frameTop
.
transform
.
localPosition
=
new
Vector3
(
0
,
lifeStoneSize
*
(
frameBorder
+
prev
)
+
d
);
for
(
int
i
=
prev
;
i
<
after
;
i
++)
{
if
(
d
>
(
after
-
i
-
1
)
*
lifeStoneSize
)
{
frameRows
[
i
].
GetComponent
<
Image
>().
color
=
new
Color
(
255
,
255
,
255
,
1
);
frameRows
[
i
].
transform
.
localPosition
=
new
Vector3
(
0
,
lifeStoneSize
*
(
frameBorder
+
i
-
after
+
prev
)
+
d
);
}
}
if
(
a
==
0
)
break
;
yield
return
null
;
}
}
StartCoroutine
(
GameObject
.
Find
(
"LifeStoneUI"
).
GetComponent
<
LifeStoneManager
>().
VibrateEnumerator
(
30
));
frameTop
=
Instantiate
(
standardImage
,
superGO
);
frameTop
.
name
=
"FrameTop"
;
frameTop
.
GetComponent
<
Image
>().
sprite
=
sprites
[
2
];
frameTop
.
GetComponent
<
RectTransform
>().
sizeDelta
=
new
Vector2
(
lifeStoneSize
*
3.4f
,
lifeStoneSize
*
0.2f
);
frameTop
.
transform
.
localPosition
=
new
Vector3
(
0
,
lifeStoneSize
*
(
0.2f
+
lifeStoneRow
));
}
}
}
}
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneInfo.cs
View file @
aacb5038
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine
;
public
class
LifeStoneInfo
:
MonoBehaviour
{
public
class
LifeStoneInfo
{
/// <summary>
/// <summary>
/// width, height of LifeStone
/// width, height of LifeStone
/// ex) □
/// ex) □
...
...
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneManager.cs
View file @
aacb5038
...
@@ -52,13 +52,14 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -52,13 +52,14 @@ public class LifeStoneManager : MonoBehaviour {
/// Array of lifestone GameObject
/// Array of lifestone GameObject
/// </summary>
/// </summary>
[
HideInInspector
]
public
GameObject
[,]
lifeStoneUnit
;
[
HideInInspector
]
public
GameObject
[,]
lifeStoneUnit
;
[
HideInInspector
]
public
LifeStoneFrame
lifeStoneFrame
;
public
GameObject
droppedLifeStonePrefab
;
public
GameObject
droppedLifeStonePrefab
;
public
float
frameBorder
;
void
Start
()
{
void
Start
()
{
transform
.
position
=
new
Vector3
(
lifeStoneLocation
.
x
,
lifeStoneLocation
.
y
,
0
);
transform
.
position
=
new
Vector3
(
lifeStoneLocation
.
x
,
lifeStoneLocation
.
y
,
0
);
lifeStoneFrame
=
new
LifeStoneFrame
(
frameSuper
.
transform
,
standardImage
,
lifeStoneRowNum
,
lifeStoneSize
,
sprites
);
frameSuper
.
GetComponent
<
LifeStoneFrame
>().
Init
(
frameSuper
.
transform
,
standardImage
,
lifeStoneRowNum
,
lifeStoneSize
,
sprites
,
frameBorder
);
lifeStoneArray
=
new
int
[
50
,
3
];
lifeStoneArray
=
new
int
[
50
,
3
];
lifeStoneUnit
=
new
GameObject
[
50
,
3
];
lifeStoneUnit
=
new
GameObject
[
50
,
3
];
for
(
int
i
=
0
;
i
<
50
;
i
++)
for
(
int
j
=
0
;
j
<
3
;
j
++)
lifeStoneArray
[
i
,
j
]
=
0
;
for
(
int
i
=
0
;
i
<
50
;
i
++)
for
(
int
j
=
0
;
j
<
3
;
j
++)
lifeStoneArray
[
i
,
j
]
=
0
;
...
@@ -66,15 +67,31 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -66,15 +67,31 @@ public class LifeStoneManager : MonoBehaviour {
}
}
IEnumerator
TestEnumerator
()
IEnumerator
TestEnumerator
()
{
{
yield
return
null
;
PushLifeStone
(
CreateLifeStoneInfo
(
5
,
0.2f
,
3
));
PushLifeStone
(
new
LifeStoneInfo
(
new
Vector2Int
(
3
,
1
),
"AAA"
));
yield
return
new
WaitForSeconds
(
2
);
PushLifeStone
(
new
LifeStoneInfo
(
new
Vector2Int
(
3
,
2
),
"AAAA A"
));
yield
return
new
WaitForSeconds
(
2
);
PushLifeStone
(
new
LifeStoneInfo
(
new
Vector2Int
(
3
,
2
),
"AAAA A"
));
yield
return
new
WaitForSeconds
(
2
);
PushLifeStone
(
new
LifeStoneInfo
(
new
Vector2Int
(
3
,
2
),
"AAAA A"
));
yield
return
new
WaitForSeconds
(
2
);
PushLifeStone
(
new
LifeStoneInfo
(
new
Vector2Int
(
3
,
2
),
"AAAA A"
));
yield
return
new
WaitForSeconds
(
2
);
PushLifeStone
(
new
LifeStoneInfo
(
new
Vector2Int
(
3
,
2
),
"AAAA A"
));
yield
return
new
WaitForSeconds
(
2
);
PushLifeStone
(
new
LifeStoneInfo
(
new
Vector2Int
(
3
,
2
),
"AAAA A"
));
yield
return
new
WaitForSeconds
(
2
);
/*PushLifeStone(CreateLifeStoneInfo(5, 0.2f, 3));
yield return new WaitForSeconds(2);
yield return new WaitForSeconds(2);
PushLifeStone(CreateLifeStoneInfo(3, 0.2f, 0));
PushLifeStone(CreateLifeStoneInfo(3, 0.2f, 0));
yield return new WaitForSeconds(2);
yield return new WaitForSeconds(2);
PushLifeStone(CreateLifeStoneInfo(4, 0.2f, 0));
PushLifeStone(CreateLifeStoneInfo(4, 0.2f, 0));
yield return new WaitForSeconds(2);
yield return new WaitForSeconds(2);
InstantiateDroppedLifeStone(CreateLifeStoneInfo(4, 0.1f, 0), GameObject.Find("Player").transform.position + new Vector3(2,2,0));
InstantiateDroppedLifeStone(CreateLifeStoneInfo(4, 0.1f, 0), GameObject.Find("Player").transform.position + new Vector3(2,2,0));
/*PushLifeStone(new LifeStoneInfo(new Vector2Int(3, 8), "AAAAAAAAAAAAAAAAAAAAAAAA"));
yield return new WaitForSeconds(2);
ExpandRow(4);
PushLifeStone(new LifeStoneInfo(new Vector2Int(3, 8), "AAAAAAAAAAAAAAAAAAAAAAAA"));
PushLifeStone(new LifeStoneInfo(new Vector2Int(2, 5), " AAAABA A "));
PushLifeStone(new LifeStoneInfo(new Vector2Int(2, 5), " AAAABA A "));
yield return new WaitForSeconds(2);
yield return new WaitForSeconds(2);
PushLifeStone(new LifeStoneInfo(new Vector2Int(2, 3), " AAA A"));
PushLifeStone(new LifeStoneInfo(new Vector2Int(2, 3), " AAA A"));
...
@@ -84,6 +101,12 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -84,6 +101,12 @@ public class LifeStoneManager : MonoBehaviour {
ChangeToNormal(2, 3);
ChangeToNormal(2, 3);
yield return new WaitForSeconds(2);
yield return new WaitForSeconds(2);
DestroyStone(3);*/
DestroyStone(3);*/
}
public
void
ExpandRow
(
int
rowNum
)
{
lifeStoneRowNum
+=
rowNum
;
frameSuper
.
GetComponent
<
LifeStoneFrame
>().
AddRow
(
lifeStoneRowNum
);
}
}
public
void
InstantiateDroppedLifeStone
(
LifeStoneInfo
info
,
Vector3
pos
)
public
void
InstantiateDroppedLifeStone
(
LifeStoneInfo
info
,
Vector3
pos
)
{
{
...
@@ -94,8 +117,8 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -94,8 +117,8 @@ public class LifeStoneManager : MonoBehaviour {
{
{
System
.
Random
rnd
=
new
System
.
Random
();
System
.
Random
rnd
=
new
System
.
Random
();
num
=
Mathf
.
Max
(
1
,
num
);
num
=
Mathf
.
Max
(
1
,
num
);
size
.
y
=
Mathf
.
Min
(
3
,
size
.
y
);
size
.
x
=
Mathf
.
Min
(
3
,
size
.
x
);
if
(
num
>
=
size
.
x
*
size
.
y
)
if
(
num
>
size
.
x
*
size
.
y
)
return
CreateLifeStoneInfo
(
size
,
goldPer
,
ameNum
);
return
CreateLifeStoneInfo
(
size
,
goldPer
,
ameNum
);
int
[,]
tmpArray
=
new
int
[
size
.
y
,
size
.
x
]
;
int
[,]
tmpArray
=
new
int
[
size
.
y
,
size
.
x
]
;
...
@@ -174,14 +197,35 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -174,14 +197,35 @@ public class LifeStoneManager : MonoBehaviour {
}
}
public
LifeStoneInfo
CreateLifeStoneInfo
(
LifeStoneInfo
lifeStoneInfo
)
public
LifeStoneInfo
CreateLifeStoneInfo
(
LifeStoneInfo
lifeStoneInfo
)
{
{
return
lifeStoneInfo
;
Vector2Int
size
=
lifeStoneInfo
.
getSize
();
Vector2Int
newSize
;
string
fill
=
lifeStoneInfo
.
getFill
();
string
newFill
=
""
;
Vector2Int
maxPoint
=
new
Vector2Int
(-
1
,
-
1
);
Vector2Int
minPoint
=
new
Vector2Int
(
size
.
x
+
1
,
size
.
y
+
1
);
for
(
int
j
=
0
;
j
<
size
.
y
;
j
++)
for
(
int
i
=
0
;
i
<
size
.
x
;
i
++)
if
(
fill
[
j
*
size
.
x
+
i
]
!=
' '
)
{
maxPoint
.
x
=
Mathf
.
Max
(
i
,
maxPoint
.
x
);
maxPoint
.
y
=
Mathf
.
Max
(
j
,
maxPoint
.
y
);
minPoint
.
x
=
Mathf
.
Min
(
i
,
minPoint
.
x
);
minPoint
.
y
=
Mathf
.
Min
(
j
,
minPoint
.
y
);
}
newSize
=
maxPoint
-
minPoint
+
Vector2Int
.
one
;
for
(
int
j
=
minPoint
.
y
;
j
<=
maxPoint
.
y
;
j
++)
newFill
+=
fill
.
Substring
(
j
*
size
.
x
+
minPoint
.
x
,
newSize
.
x
);
return
new
LifeStoneInfo
(
newSize
,
newFill
);
}
}
/// <summary>
/// <summary>
/// push LifeStone in LifeStoneFrame
/// push LifeStone in LifeStoneFrame
/// </summary>
/// </summary>
/// <param name="pushInfo"></param>
/// <param name="pushInfo"></param>
void
PushLifeStone
(
LifeStoneInfo
pushInfo
)
public
void
PushLifeStone
(
LifeStoneInfo
pushInfo
)
{
{
System
.
Random
rnd
=
new
System
.
Random
();
System
.
Random
rnd
=
new
System
.
Random
();
Vector2Int
pSize
=
pushInfo
.
getSize
();
Vector2Int
pSize
=
pushInfo
.
getSize
();
...
@@ -219,9 +263,15 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -219,9 +263,15 @@ public class LifeStoneManager : MonoBehaviour {
selectedCol
=
(
int
)
selColCand
[
rnd
.
Next
(
selColCand
.
Count
)];
selectedCol
=
(
int
)
selColCand
[
rnd
.
Next
(
selColCand
.
Count
)];
float
vibration
=
pushInfo
.
getAmount
()
*
vibrationVariable
*
lifeStoneSize
;
float
vibration
=
pushInfo
.
getAmount
()
*
vibrationVariable
*
lifeStoneSize
;
int
cutRow
=
pSize
.
y
;
for
(
int
pj
=
0
;
pj
<
pSize
.
y
;
pj
++)
for
(
int
pj
=
0
;
pj
<
pSize
.
y
;
pj
++)
{
{
if
(
selectedRow
+
pj
>=
lifeStoneRowNum
)
break
;
if
(
selectedRow
+
pj
>=
lifeStoneRowNum
)
{
cutRow
=
pj
;
break
;
}
for
(
int
pi
=
0
;
pi
<
pSize
.
x
;
pi
++)
for
(
int
pi
=
0
;
pi
<
pSize
.
x
;
pi
++)
if
(
pFill
[
pj
*
pSize
.
x
+
pi
]
!=
' '
)
if
(
pFill
[
pj
*
pSize
.
x
+
pi
]
!=
' '
)
{
{
...
@@ -234,12 +284,41 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -234,12 +284,41 @@ public class LifeStoneManager : MonoBehaviour {
lifeStoneSize
,
lifeStoneSize
,
new
Vector2Int
(
xtmp
,
ytmp
),
new
Vector2Int
(
xtmp
,
ytmp
),
new
Vector2Int
(
xtmp
,
lifeStoneRowNum
+
pj
),
new
Vector2Int
(
xtmp
,
lifeStoneRowNum
+
pj
),
new
Vector2
(
0.2f
*
lifeStoneSize
,
0.2f
*
lifeStoneSize
),
new
Vector2
(
frameBorder
*
lifeStoneSize
,
frameBorder
*
lifeStoneSize
),
vibration
);
vibration
);
vibration
=
0
;
vibration
=
0
;
}
}
}
}
if
(
cutRow
<
pSize
.
y
)
{
char
[]
chFill
=
pFill
.
ToCharArray
();
for
(
int
i
=
0
;
i
<
pSize
.
x
;
i
++)
{
Queue
<
Vector2Int
>
queue
=
new
Queue
<
Vector2Int
>();
char
[]
newFill
=
new
char
[
pSize
.
x
*
(
pSize
.
y
-
cutRow
)];
for
(
int
t
=
0
;
t
<
pSize
.
x
*
(
pSize
.
y
-
cutRow
);
t
++)
newFill
[
t
]
=
' '
;
if
(
chFill
[
cutRow
*
pSize
.
x
+
i
]
!=
' '
)
{
queue
.
Enqueue
(
new
Vector2Int
(
i
,
cutRow
));
while
(
queue
.
Count
>
0
)
{
Vector2Int
vtmp
=
queue
.
Dequeue
();
newFill
[(
vtmp
.
y
-
cutRow
)
*
pSize
.
x
+
vtmp
.
x
]
=
chFill
[
vtmp
.
y
*
pSize
.
x
+
vtmp
.
x
];
chFill
[
vtmp
.
y
*
pSize
.
x
+
vtmp
.
x
]
=
' '
;
if
(
vtmp
.
x
+
1
<
pSize
.
x
&&
chFill
[
vtmp
.
y
*
pSize
.
x
+
(
vtmp
.
x
+
1
)]
!=
' '
)
queue
.
Enqueue
(
new
Vector2Int
(
vtmp
.
x
+
1
,
vtmp
.
y
));
if
(
vtmp
.
x
-
1
>=
0
&&
chFill
[
vtmp
.
y
*
pSize
.
x
+
(
vtmp
.
x
-
1
)]
!=
' '
)
queue
.
Enqueue
(
new
Vector2Int
(
vtmp
.
x
-
1
,
vtmp
.
y
));
if
(
vtmp
.
y
+
1
<
pSize
.
y
&&
chFill
[(
vtmp
.
y
+
1
)
*
pSize
.
x
+
vtmp
.
x
]
!=
' '
)
queue
.
Enqueue
(
new
Vector2Int
(
vtmp
.
x
,
vtmp
.
y
+
1
));
if
(
vtmp
.
y
-
1
>=
cutRow
&&
chFill
[(
vtmp
.
y
-
1
)
*
pSize
.
x
+
vtmp
.
x
]
!=
' '
)
queue
.
Enqueue
(
new
Vector2Int
(
vtmp
.
x
,
vtmp
.
y
-
1
));
}
InstantiateDroppedLifeStone
(
CreateLifeStoneInfo
(
new
LifeStoneInfo
(
new
Vector2Int
(
pSize
.
x
,
pSize
.
y
-
cutRow
),
new
string
(
newFill
))),
GameObject
.
Find
(
"Player"
).
transform
.
position
+
new
Vector3
(
droppedLifeStonePrefab
.
GetComponent
<
DroppedLifeStone
>().
unitSprite
.
GetComponent
<
SpriteRenderer
>().
bounds
.
size
.
x
*
i
,
0
,
0
));
}
}
}
}
}
public
int
CountType
(
int
type
)
public
int
CountType
(
int
type
)
{
{
...
@@ -286,7 +365,7 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -286,7 +365,7 @@ public class LifeStoneManager : MonoBehaviour {
Vector2Int
vtmp
=
(
Vector2Int
)
candArray
[
i
];
Vector2Int
vtmp
=
(
Vector2Int
)
candArray
[
i
];
lifeStoneUnit
[
vtmp
.
y
,
vtmp
.
x
].
GetComponent
<
LifeUnitInFrame
>().
unitDestroy
();
lifeStoneUnit
[
vtmp
.
y
,
vtmp
.
x
].
GetComponent
<
LifeUnitInFrame
>().
unitDestroy
();
lifeStoneUnit
[
vtmp
.
y
,
vtmp
.
x
]
=
null
;
lifeStoneUnit
[
vtmp
.
y
,
vtmp
.
x
]
=
null
;
yield
return
new
WaitForSeconds
(
0.
1
f
);
yield
return
new
WaitForSeconds
(
0.
02
f
);
}
}
}
}
...
@@ -339,7 +418,7 @@ public class LifeStoneManager : MonoBehaviour {
...
@@ -339,7 +418,7 @@ public class LifeStoneManager : MonoBehaviour {
}
}
}
}
public
IEnumerator
v
ibrateEnumerator
(
float
vibration
)
public
IEnumerator
V
ibrateEnumerator
(
float
vibration
)
{
{
while
(
vibration
>
lifeStoneSize
*
0.05f
)
while
(
vibration
>
lifeStoneSize
*
0.05f
)
{
{
...
...
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneTest.cs
0 → 100644
View file @
aacb5038
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.UI
;
using
System.Text
;
using
System
;
public
class
LifeStoneTest
:
MonoBehaviour
{
public
GameObject
numText
,
ameNumText
,
goldPerText
,
goldText
,
amethystText
,
destroyText
,
rowText
;
public
GameObject
ui
;
LifeStoneManager
uii
;
private
void
Start
()
{
uii
=
ui
.
GetComponent
<
LifeStoneManager
>();
}
public
void
push
()
{
uii
.
PushLifeStone
(
uii
.
CreateLifeStoneInfo
(
Convert
.
ToInt32
(
numText
.
GetComponent
<
InputField
>().
text
),
Convert
.
ToSingle
(
goldPerText
.
GetComponent
<
InputField
>().
text
),
Convert
.
ToInt32
(
ameNumText
.
GetComponent
<
InputField
>().
text
)));
}
public
void
gold
()
{
int
tmp
=
Convert
.
ToInt32
(
goldText
.
GetComponent
<
InputField
>().
text
);
if
(
tmp
>
0
)
uii
.
ChangeFromNormal
(
2
,
tmp
);
else
if
(
tmp
<
0
)
uii
.
ChangeToNormal
(
2
,
-
tmp
);
}
public
void
amethyst
()
{
int
tmp
=
Convert
.
ToInt32
(
amethystText
.
GetComponent
<
InputField
>().
text
);
if
(
tmp
>
0
)
uii
.
ChangeFromNormal
(
3
,
tmp
);
else
if
(
tmp
<
0
)
uii
.
ChangeToNormal
(
3
,
-
tmp
);
}
public
void
dest
()
{
uii
.
DestroyStone
(
Convert
.
ToInt32
(
destroyText
.
GetComponent
<
InputField
>().
text
));
}
public
void
row
()
{
uii
.
ExpandRow
(
Convert
.
ToInt32
(
rowText
.
GetComponent
<
InputField
>().
text
));
}
}
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneTest.cs.meta
0 → 100644
View file @
aacb5038
fileFormatVersion: 2
guid: 050cdf1acdf12e9409463fdfa82ace6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeUnitInFrame.cs
View file @
aacb5038
...
@@ -58,7 +58,7 @@ public class LifeUnitInFrame : MonoBehaviour {
...
@@ -58,7 +58,7 @@ public class LifeUnitInFrame : MonoBehaviour {
}
}
IEnumerator
FadeInEnumerator
()
IEnumerator
FadeInEnumerator
()
{
{
StartCoroutine
(
"FallEnumerator"
);
float
alpha
=
0
;
float
alpha
=
0
;
float
fadeTime
=
0.3f
;
float
fadeTime
=
0.3f
;
while
(
alpha
<=
1f
)
while
(
alpha
<=
1f
)
...
@@ -68,7 +68,7 @@ public class LifeUnitInFrame : MonoBehaviour {
...
@@ -68,7 +68,7 @@ public class LifeUnitInFrame : MonoBehaviour {
yield
return
null
;
yield
return
null
;
}
}
GetComponent
<
Image
>().
color
=
new
Color
(
255
,
255
,
255
,
1f
);
GetComponent
<
Image
>().
color
=
new
Color
(
255
,
255
,
255
,
1f
);
StartCoroutine
(
"FallEnumerator"
);
}
}
IEnumerator
FallEnumerator
()
IEnumerator
FallEnumerator
()
{
{
...
@@ -85,7 +85,7 @@ public class LifeUnitInFrame : MonoBehaviour {
...
@@ -85,7 +85,7 @@ public class LifeUnitInFrame : MonoBehaviour {
yield
return
null
;
yield
return
null
;
}
}
if
(
vibration
!=
0
)
if
(
vibration
!=
0
)
StartCoroutine
(
GameObject
.
Find
(
"LifeStoneUI"
).
GetComponent
<
LifeStoneManager
>().
v
ibrateEnumerator
(
vibration
));
StartCoroutine
(
GameObject
.
Find
(
"LifeStoneUI"
).
GetComponent
<
LifeStoneManager
>().
V
ibrateEnumerator
(
vibration
));
}
}
}
}
ProjectSettings/Physics2DSettings.asset
View file @
aacb5038
...
@@ -52,4 +52,4 @@ Physics2DSettings:
...
@@ -52,4 +52,4 @@ Physics2DSettings:
m_ColliderAsleepColor
:
{
r
:
0.5686275
,
g
:
0.95686275
,
b
:
0.54509807
,
a
:
0.36078432
}
m_ColliderAsleepColor
:
{
r
:
0.5686275
,
g
:
0.95686275
,
b
:
0.54509807
,
a
:
0.36078432
}
m_ColliderContactColor
:
{
r
:
1
,
g
:
0
,
b
:
1
,
a
:
0.6862745
}
m_ColliderContactColor
:
{
r
:
1
,
g
:
0
,
b
:
1
,
a
:
0.6862745
}
m_ColliderAABBColor
:
{
r
:
1
,
g
:
1
,
b
:
0
,
a
:
0.2509804
}
m_ColliderAABBColor
:
{
r
:
1
,
g
:
1
,
b
:
0
,
a
:
0.2509804
}
m_LayerCollisionMatrix
:
ff
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix
:
ff
dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9fffffffd
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ProjectSettings/TagManager.asset
View file @
aacb5038
...
@@ -22,7 +22,7 @@ TagManager:
...
@@ -22,7 +22,7 @@ TagManager:
-
Platform
-
Platform
-
OuterWall
-
OuterWall
-
Item
-
Item
-
ItemHighlight
-
-
-
-
-
-
-
...
...
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