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
33a4595c
Commit
33a4595c
authored
Jan 12, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
프레스가 지나가서 삭제될 방들에 대한 작업 구현중
parent
b62bd7d5
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
46 deletions
+114
-46
MapManager.prefab
Assets/Prefabs/MapManager.prefab
+1
-1
CameraController.cs
Assets/Scripts/CameraController.cs
+4
-4
Player.cs
Assets/Scripts/Characters/Player.cs
+2
-2
MapManager.cs
Assets/Scripts/TetrisMap/MapManager.cs
+21
-10
Room.cs
Assets/Scripts/TetrisMap/Room.cs
+86
-29
No files found.
Assets/Prefabs/MapManager.prefab
View file @
33a4595c
...
...
@@ -52,6 +52,7 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
grid
:
{
fileID
:
0
}
player
:
{
fileID
:
0
}
initialFallSpeed
:
-0.1
gravity
:
0.98
timeToFallTetrimino
:
100
...
...
@@ -59,7 +60,6 @@ MonoBehaviour:
tetriminoCreatedTime
:
0
collapseTime
:
10
gameOver
:
0
isTetriminoFalling
:
0
spawnBossTetrimino
:
0
press
:
{
fileID
:
114990664041074520
,
guid
:
8e750fd197a05d84c9fb8557eb95c666
,
type
:
2
}
currentTetrimino
:
{
fileID
:
0
}
...
...
Assets/Scripts/CameraController.cs
View file @
33a4595c
...
...
@@ -61,12 +61,12 @@ public class CameraController : MonoBehaviour {
StopCoroutine
(
fadeOut
);
if
(
GameManager
.
gameState
==
GameManager
.
GameState
.
Ingame
)
{
fadeIn
=
StartCoroutine
(
M
apManager
.
RoomFadeIn
(
MapManager
.
currentRoom
));
fadeIn
=
StartCoroutine
(
m
apManager
.
RoomFadeIn
(
MapManager
.
currentRoom
));
grid
.
transform
.
position
=
new
Vector3
(
0
,
0
,
0
);
}
else
if
(
GameManager
.
gameState
==
GameManager
.
GameState
.
Tetris
)
{
fadeOut
=
StartCoroutine
(
M
apManager
.
RoomFadeOut
(
MapManager
.
currentRoom
));
fadeOut
=
StartCoroutine
(
m
apManager
.
RoomFadeOut
(
MapManager
.
currentRoom
));
grid
.
transform
.
position
=
new
Vector3
(
0
,
0
,
2
);
}
while
((
_gameState
==
GameManager
.
GameState
.
Tetris
&&
GetComponent
<
Camera
>().
orthographicSize
<
sizeDestination
-
1
)
||
(
_gameState
==
GameManager
.
GameState
.
Ingame
&&
GetComponent
<
Camera
>().
orthographicSize
>
sizeDestination
+
0.0001
))
...
...
@@ -138,10 +138,10 @@ public class CameraController : MonoBehaviour {
transform
.
position
=
Vector3
.
Lerp
(
transform
.
position
,
new
Vector3
(
posx
,
posy
,
-
1
),
2f
*
Time
.
deltaTime
);
transform
.
position
=
new
Vector3
(
transform
.
position
.
x
,
transform
.
position
.
y
,
-
1
);
//카메라를 원래 z축으로 이동
}
else
if
(
MapManager
.
isRoomFalling
==
true
)
/*
else if(MapManager.isRoomFalling == true)
{
transform.position = player.transform.position + new Vector3(0, 0.2f, -1);
}
}
*/
}
// Camera.main.transform.position = new Vector3(posx, posy, -10);
}
...
...
Assets/Scripts/Characters/Player.cs
View file @
33a4595c
...
...
@@ -27,8 +27,8 @@ public class Player : MonoBehaviour {
StopCoroutine
(
roomEnterFadeIn
);
if
(
roomExitFadeOut
!=
null
)
StopCoroutine
(
roomExitFadeOut
);
roomEnterFadeIn
=
StartCoroutine
(
MapManager
.
RoomFadeIn
(
MapManager
.
currentRoom
));
roomExitFadeOut
=
StartCoroutine
(
MapManager
.
RoomFadeOut
(
MapManager
.
mapGrid
[
ttx
,
tty
]));
roomEnterFadeIn
=
StartCoroutine
(
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>()
.
RoomFadeIn
(
MapManager
.
currentRoom
));
roomExitFadeOut
=
StartCoroutine
(
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>()
.
RoomFadeOut
(
MapManager
.
mapGrid
[
ttx
,
tty
]));
}
ttx
=
tx
;
tty
=
ty
;
...
...
Assets/Scripts/TetrisMap/MapManager.cs
View file @
33a4595c
...
...
@@ -255,14 +255,23 @@ public class MapManager : MonoBehaviour {
/// <returns></returns>
public
IEnumerator
TetrisPress
(
float
initialCollapseTime
,
Press
leftPress
,
Press
rightPress
)
{
int
doorCounter
=
0
;
int
row
=
leftPress
.
row
;
while
(
Time
.
time
-
initialCollapseTime
<
collapseTime
)
{
yield
return
new
WaitForSeconds
(
0.01f
);
float
collapseRate
=
(
Time
.
time
-
initialCollapseTime
)
/
collapseTime
;
leftPress
.
transform
.
localScale
=
new
Vector3
(
collapseRate
*
20
,
1
,
1
);
rightPress
.
transform
.
localScale
=
new
Vector3
(-
collapseRate
*
20
,
1
,
1
);
if
(
collapseRate
-
doorCounter
*
0.2f
>
(
float
)
1
/
12
)
{
StartCoroutine
(
mapGrid
[
doorCounter
,
row
].
CloseDoor
(
"Up"
));
StartCoroutine
(
mapGrid
[
doorCounter
,
row
].
CloseDoor
(
"Down"
));
StartCoroutine
(
mapGrid
[
width
-
doorCounter
-
1
,
row
].
CloseDoor
(
"Up"
));
StartCoroutine
(
mapGrid
[
width
-
doorCounter
-
1
,
row
].
CloseDoor
(
"Down"
));
doorCounter
++;
}
}
int
row
=
leftPress
.
row
;
for
(
int
i
=
row
+
1
;
i
<
realHeight
;
i
++)
{
if
(
isRowDeleting
[
i
])
...
...
@@ -273,14 +282,9 @@ public class MapManager : MonoBehaviour {
}
for
(
int
x
=
0
;
x
<
width
;
x
++)
{
if
(
row
>
0
&&
isRowDeleting
[
row
-
1
]
!=
true
&&
mapGrid
[
x
,
row
-
1
]
!=
null
&&
mapGrid
[
x
,
row
-
1
].
isUpDoorOpened
==
true
)
StartCoroutine
(
mapGrid
[
x
,
row
-
1
].
CloseDoor
(
"Up"
));
if
(
row
<
realHeight
&&
isRowDeleting
[
row
+
1
]
!=
true
&&
mapGrid
[
x
,
row
+
1
]
!=
null
&&
mapGrid
[
x
,
row
+
1
].
isDownDoorOpened
==
true
)
StartCoroutine
(
mapGrid
[
x
,
row
+
1
].
CloseDoor
(
"Down"
));
Destroy
(
mapGrid
[
x
,
row
].
gameObject
);
mapGrid
[
x
,
row
]
=
null
;
}
yield
return
new
WaitForSeconds
(
1f
);
while
(
leftPress
.
transform
.
localScale
.
x
>
1
)
{
yield
return
new
WaitForSeconds
(
0.01f
);
...
...
@@ -362,7 +366,6 @@ public class MapManager : MonoBehaviour {
}
isRoomFalling
=
true
;
Vector3
previousPlayerRelativePosition
=
player
.
transform
.
position
-
currentRoom
.
transform
.
position
;
player
.
transform
.
position
+=
new
Vector3
(
0
,
0.2f
,
0
);
while
(
tetrisYCoord
[
top
+
1
]
>
bottom
*
tetrisMapSize
)
{
yield
return
new
WaitForSeconds
(
0.01f
);
...
...
@@ -379,7 +382,8 @@ public class MapManager : MonoBehaviour {
tetrisYCoord
[
i
]
-=
yFallSpeed
;
}
SetRoomsYCoord
();
player
.
transform
.
position
+=
new
Vector3
(
0
,
-
yFallSpeed
,
0
);
if
(
currentRoom
.
mapCoord
.
y
>=
bottom
)
player
.
transform
.
position
+=
new
Vector3
(
0
,
-
yFallSpeed
,
0
);
}
if
(
shakeCamera
)
{
...
...
@@ -770,9 +774,16 @@ public class MapManager : MonoBehaviour {
/// </summary>
/// <param name="room">Room you want to fade in.</param>
/// <returns></returns>
public
static
IEnumerator
RoomFadeIn
(
Room
room
)
public
IEnumerator
RoomFadeIn
(
Room
room
)
{
float
alpha
=
1
;
if
(
room
.
isRoomCleared
!=
true
)
{
StartCoroutine
(
room
.
CloseDoor
(
"Up"
));
StartCoroutine
(
room
.
CloseDoor
(
"Down"
));
StartCoroutine
(
room
.
CloseDoor
(
"Left"
));
StartCoroutine
(
room
.
CloseDoor
(
"Right"
));
}
while
(
alpha
>
0.0001
)
{
alpha
=
Mathf
.
Lerp
(
alpha
,
0
,
Mathf
.
Sqrt
(
Time
.
deltaTime
));
...
...
@@ -792,7 +803,7 @@ public class MapManager : MonoBehaviour {
/// </summary>
/// <param name="room">Room you want to fade out.</param>
/// <returns></returns>
public
static
IEnumerator
RoomFadeOut
(
Room
room
)
public
IEnumerator
RoomFadeOut
(
Room
room
)
{
float
alpha
=
0
;
while
(
alpha
<
0.99909
)
...
...
Assets/Scripts/TetrisMap/Room.cs
View file @
33a4595c
This diff is collapsed.
Click to expand it.
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