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
fe5df774
Commit
fe5df774
authored
Feb 22, 2019
by
18류지석
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
생명석 잘려서 튀어나오는거 직관적으로 바뀜
parent
a7668b1f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
33 deletions
+75
-33
LifeStoneManager.cs
...Scripts/UI/In-game UI/LifeStoneScript/LifeStoneManager.cs
+54
-30
LifeUnitInFrame.cs
.../Scripts/UI/In-game UI/LifeStoneScript/LifeUnitInFrame.cs
+21
-3
No files found.
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeStoneManager.cs
View file @
fe5df774
...
...
@@ -62,6 +62,8 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
public
float
popoutStrengthMultiplier
;
public
float
popoutTime
;
bool
stoneCut
;
void
Start
()
{
lifeStoneUI
.
transform
.
position
=
new
Vector3
(
lifeStoneLocation
.
x
,
lifeStoneLocation
.
y
,
0
);
frameSuper
.
GetComponent
<
LifeStoneFrame
>().
Init
(
frameSuper
.
transform
,
standardImage
,
lifeStoneRowNum
,
lifeStoneSize
,
sprites
,
frameBorder
);
...
...
@@ -318,20 +320,26 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
for
(
int
pj
=
0
;
pj
<
pSize
.
y
;
pj
++)
{
if
(
selectedRow
+
pj
>=
lifeStoneRowNum
)
if
(
cutRow
==
pSize
.
y
&&
selectedRow
+
pj
>=
lifeStoneRowNum
)
{
cutRow
=
pj
;
break
;
//
break;
}
for
(
int
pi
=
0
;
pi
<
pSize
.
x
;
pi
++)
if
(
pFill
[
pj
*
pSize
.
x
+
pi
]
!=
' '
)
{
int
xtmp
=
selectedCol
+
pi
,
ytmp
=
selectedRow
+
pj
;
lifeStoneArray
[
ytmp
,
xtmp
]
=
pFill
[
pj
*
pSize
.
x
+
pi
]
-
'A'
+
1
;
lifeStoneUnit
[
ytmp
,
xtmp
]
=
Instantiate
(
lifeUnitPrefab
,
stoneSuper
.
transform
);
GameObject
tmpObj
;
tmpObj
=
Instantiate
(
lifeUnitPrefab
,
stoneSuper
.
transform
);
lifeStoneUnit
[
ytmp
,
xtmp
].
GetComponent
<
LifeUnitInFrame
>().
Init
(
lifeStoneArray
[
ytmp
,
xtmp
],
if
(
pj
<
cutRow
)
{
lifeStoneArray
[
ytmp
,
xtmp
]
=
pFill
[
pj
*
pSize
.
x
+
pi
]
-
'A'
+
1
;
lifeStoneUnit
[
ytmp
,
xtmp
]
=
tmpObj
;
}
tmpObj
.
GetComponent
<
LifeUnitInFrame
>().
Init
(
pFill
[
pj
*
pSize
.
x
+
pi
]
-
'A'
+
1
,
lifeStoneSize
,
new
Vector2Int
(
xtmp
,
ytmp
),
new
Vector2Int
(
xtmp
,
lifeStoneRowNum
+
pj
),
...
...
@@ -341,37 +349,53 @@ public class LifeStoneManager : Singleton<LifeStoneManager> {
vibration
=
0
;
}
}
stoneCut
=
false
;
if
(
cutRow
<
pSize
.
y
)
{
char
[]
chFill
=
pFill
.
ToCharArray
();
for
(
int
i
=
0
;
i
<
pSize
.
x
;
i
++)
StartCoroutine
(
CutCoroutine
(
cutRow
,
pSize
,
pFill
));
}
return
true
;
}
public
void
StoneCutStart
()
{
stoneCut
=
true
;
}
IEnumerator
CutCoroutine
(
int
cutRow
,
Vector2Int
pSize
,
string
pFill
)
{
while
(!
stoneCut
)
{
yield
return
null
;
}
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
<
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
)
{
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
),
1f
);
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
),
1f
);
}
}
return
true
;
}
}
/// <summary>
/// count lifestoneunit in lifestoneframe by type
...
...
Assets/Scripts/UI/In-game UI/LifeStoneScript/LifeUnitInFrame.cs
View file @
fe5df774
...
...
@@ -61,11 +61,11 @@ public class LifeUnitInFrame : MonoBehaviour {
float
fadeTime
=
0.3f
;
while
(
alpha
<=
1f
)
{
GetComponent
<
Image
>().
color
=
new
Color
(
255
,
255
,
255
,
alpha
);
GetComponent
<
Image
>().
color
=
new
Color
(
1
,
1
,
1
,
alpha
);
alpha
+=
1f
/
fadeTime
*
Time
.
deltaTime
;
yield
return
null
;
}
GetComponent
<
Image
>().
color
=
new
Color
(
255
,
255
,
255
,
1f
);
GetComponent
<
Image
>().
color
=
new
Color
(
1
,
1
,
1
,
1f
);
}
IEnumerator
FallEnumerator
()
...
...
@@ -84,6 +84,24 @@ public class LifeUnitInFrame : MonoBehaviour {
if
(
vibration
!=
0
)
StartCoroutine
(
LifeStoneManager
.
Instance
.
VibrateEnumerator
(
vibration
));
if
(
pos
.
y
>=
LifeStoneManager
.
Instance
.
lifeStoneRowNum
)
StartCoroutine
(
FadeOutEnumerator
());
}
IEnumerator
FadeOutEnumerator
()
{
float
alpha
=
1f
;
float
fadeTime
=
0.3f
;
while
(
alpha
>=
0f
)
{
GetComponent
<
Image
>().
color
=
new
Color
(
1
,
1
,
1
,
alpha
);
alpha
-=
1f
/
fadeTime
*
Time
.
deltaTime
;
yield
return
null
;
}
GetComponent
<
Image
>().
color
=
new
Color
(
1
,
1
,
1
,
0f
);
LifeStoneManager
.
Instance
.
StoneCutStart
();
Destroy
(
gameObject
);
}
}
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