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
be57d90b
Commit
be57d90b
authored
Jan 30, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
방 이동할 때 버그 수정, 이제 포탈을 사용할 땐 테트리미노가 떨어지거나 프레스가 작동하는등의 기능이 정지함. 또 프레스가 생성된 줄의 포탈은 즉시 삭제됨
parent
cd735704
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
538 additions
and
35 deletions
+538
-35
GameManager.prefab
Assets/Prefabs/GameManager.prefab
+2
-1
GameOverScreen.prefab
Assets/Prefabs/UI/GameOverScreen.prefab
+453
-0
GameOverScreen.prefab.meta
Assets/Prefabs/UI/GameOverScreen.prefab.meta
+8
-0
CameraController.cs
Assets/Scripts/CameraController.cs
+0
-12
Player.cs
Assets/Scripts/Characters/Player.cs
+0
-2
PlayerController.cs
Assets/Scripts/Characters/PlayerController.cs
+1
-1
GameManager.cs
Assets/Scripts/GameManager.cs
+21
-12
Door.cs
Assets/Scripts/TetrisMap/Door.cs
+1
-1
MapManager.cs
Assets/Scripts/TetrisMap/MapManager.cs
+36
-6
Portal.cs
Assets/Scripts/TetrisMap/Portal.cs
+2
-0
Room.cs
Assets/Scripts/TetrisMap/Room.cs
+14
-0
No files found.
Assets/Prefabs/GameManager.prefab
View file @
be57d90b
...
...
@@ -51,4 +51,5 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
97912f0a2214a8a4f8023ed30629bb30
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
gameOverScreen
:
{
fileID
:
0
}
gameOverScreen
:
{
fileID
:
223237664237935382
,
guid
:
692aad2449e06054799ea4706578fb23
,
type
:
2
}
Assets/Prefabs/UI/GameOverScreen.prefab
0 → 100644
View file @
be57d90b
This diff is collapsed.
Click to expand it.
Assets/Prefabs/UI/GameOverScreen.prefab.meta
0 → 100644
View file @
be57d90b
fileFormatVersion: 2
guid: 692aad2449e06054799ea4706578fb23
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/CameraController.cs
View file @
be57d90b
...
...
@@ -93,18 +93,6 @@ public class CameraController : MonoBehaviour {
else
if
(
gameState
==
GameState
.
Portal
)
{
GameManager
.
gameState
=
GameState
.
Portal
;
for
(
int
x
=
0
;
x
<
MapManager
.
width
;
x
++)
MapManager
.
portalDistributedHorizontal
[
x
].
Clear
();
for
(
int
y
=
0
;
y
<=
MapManager
.
realHeight
;
y
++)
MapManager
.
portalDistributedVertical
[
y
].
Clear
();
for
(
int
x
=
0
;
x
<
MapManager
.
width
;
x
++)
for
(
int
y
=
0
;
y
<=
MapManager
.
realHeight
;
y
++)
if
(
MapManager
.
mapGrid
[
x
,
y
]
!=
null
&&
MapManager
.
mapGrid
[
x
,
y
].
isPortal
==
true
)
{
MapManager
.
portalGrid
[
x
,
y
]
=
true
;
MapManager
.
portalDistributedHorizontal
[
x
].
Add
(
y
);
MapManager
.
portalDistributedVertical
[
y
].
Add
(
x
);
}
MapManager
.
portalDestination
=
MapManager
.
currentRoom
.
mapCoord
;
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
].
portalSurface
.
GetComponent
<
SpriteRenderer
>().
sprite
=
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
portalSelected
;
...
...
Assets/Scripts/Characters/Player.cs
View file @
be57d90b
...
...
@@ -8,8 +8,6 @@ public class Player : MonoBehaviour {
public
static
float
X
=
0.7f
,
Y
=
1.6f
;
public
int
ttx
;
public
int
tty
;
Coroutine
roomEnterFadeIn
;
Coroutine
roomExitFadeOut
;
// Use this for initialization
void
Start
()
{
...
...
Assets/Scripts/Characters/PlayerController.cs
View file @
be57d90b
...
...
@@ -85,7 +85,7 @@ public class PlayerController : MonoBehaviour
{
isGrounded
=
IsGrounded
();
if
(
GameManager
.
gameState
==
GameState
.
Ingame
)
if
(
GameManager
.
gameState
==
GameState
.
Ingame
&&
MapManager
.
isDoorClosing
!=
true
)
{
if
(
isGrounded
)
...
...
Assets/Scripts/GameManager.cs
View file @
be57d90b
...
...
@@ -32,24 +32,33 @@ public class GameManager : MonoBehaviour {
// Update is called once per frame
void
Update
()
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
Tab
)
&&
CameraController
.
isSceneChanging
!=
true
)
if
(
CameraController
.
isSceneChanging
!=
true
)
{
if
(
gameState
==
GameState
.
Ingame
)
if
(
Input
.
GetKeyDown
(
KeyCode
.
Tab
)
)
{
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Tetris
));
if
(
gameState
==
GameState
.
Ingame
)
{
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Tetris
));
}
else
if
(
gameState
==
GameState
.
Tetris
)
{
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Ingame
));
}
}
else
if
(
gameState
==
GameState
.
Tetris
)
if
(
Input
.
GetKeyDown
(
KeyCode
.
F
)
)
{
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Ingame
));
if
(
gameState
==
GameState
.
Portal
&&
MapManager
.
currentRoom
!=
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
])
{
GameObject
.
Find
(
"Player"
).
transform
.
position
=
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
].
portal
.
transform
.
position
+
new
Vector3
(
2
,
1
,
0
);
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
ChangeRoom
(
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
]);
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
].
portalSurface
.
GetComponent
<
SpriteRenderer
>().
sprite
=
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
portalExist
;
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Ingame
));
}
}
}
if
(
Input
.
GetKeyDown
(
KeyCode
.
Escape
)
&&
CameraController
.
isSceneChanging
!=
true
)
{
if
(
gameState
==
GameState
.
Portal
)
if
(
Input
.
GetKeyDown
(
KeyCode
.
Escape
))
{
GameObject
.
Find
(
"Player"
).
transform
.
position
=
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
].
portal
.
transform
.
position
+
new
Vector3
(
2
,
1
,
0
);
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
ChangeRoom
(
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
]);
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
].
portalSurface
.
GetComponent
<
SpriteRenderer
>().
sprite
=
MapManager
.
mapGrid
[(
int
)
MapManager
.
currentRoom
.
mapCoord
.
x
,
(
int
)
MapManager
.
currentRoom
.
mapCoord
.
y
].
portalSurface
.
GetComponent
<
SpriteRenderer
>().
sprite
=
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
portalExist
;
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Ingame
));
}
...
...
Assets/Scripts/TetrisMap/Door.cs
View file @
be57d90b
...
...
@@ -35,7 +35,7 @@ public class Door : MonoBehaviour {
enteredPosition
=
2
;
break
;
case
1
:
if
(
collision
.
transform
.
position
.
x
<
GetComponent
<
PolygonCollider2D
>().
transform
.
position
.
x
+
0.6f
)
if
(
collision
.
transform
.
position
.
x
<
GetComponent
<
PolygonCollider2D
>().
transform
.
position
.
x
+
0.6f
)
return
;
enteredPosition
=
3
;
break
;
...
...
Assets/Scripts/TetrisMap/MapManager.cs
View file @
be57d90b
...
...
@@ -5,7 +5,6 @@ using UnityEngine;
public
class
MapManager
:
MonoBehaviour
{
public
static
bool
isDoorClosing
=
false
;
/*
* variables
* */
...
...
@@ -82,6 +81,10 @@ public class MapManager : MonoBehaviour {
/// </summary>
public
static
bool
isRoomFalling
=
false
;
/// <summary>
/// Check if door is closing or not.
/// </summary>
public
static
bool
isDoorClosing
=
false
;
/// <summary>
/// Check if this row is being deleted.
/// </summary>
public
static
bool
[]
isRowDeleting
=
new
bool
[
20
];
...
...
@@ -303,11 +306,25 @@ public class MapManager : MonoBehaviour {
int
roomDestroyCounter
=
0
;
int
row
=
leftPress
.
row
;
float
collapseSpeed
=
(
float
)
20
/
collapseTime
*
Time
.
deltaTime
;
portalDistributedVertical
[
row
].
Clear
();
for
(
int
i
=
0
;
i
<
portalDistributedHorizontal
.
Length
;
i
++)
portalDistributedHorizontal
[
i
].
Remove
(
row
);
for
(
int
i
=
0
;
i
<
width
;
i
++)
if
(
mapGrid
[
i
,
row
].
isPortal
==
true
)
{
mapGrid
[
i
,
row
].
isPortal
=
false
;
Destroy
(
mapGrid
[
i
,
row
].
portalSurface
);
mapGrid
[
i
,
row
].
portal
.
SetActive
(
false
);
}
leftPress
.
transform
.
localScale
=
new
Vector3
(
0
,
1
,
1
);
rightPress
.
transform
.
localScale
=
new
Vector3
(
0
,
1
,
1
);
float
collapseRate
=
leftPress
.
transform
.
localScale
.
x
;
while
(
collapseRate
<
20
)
{
while
(
GameManager
.
gameState
==
GameState
.
Portal
)
{
yield
return
null
;
}
yield
return
null
;
if
(
currentRoom
.
mapCoord
.
y
==
row
)
collapseSpeed
=
(
float
)
2
/
collapseTime
*
Time
.
deltaTime
;
...
...
@@ -427,6 +444,10 @@ public class MapManager : MonoBehaviour {
Vector3
previousPlayerRelativePosition
=
player
.
transform
.
position
-
currentRoom
.
transform
.
position
;
while
(
tetrisYCoord
[
top
+
1
]
>
bottom
*
tetrisMapSize
)
{
while
(
GameManager
.
gameState
==
GameState
.
Portal
)
{
yield
return
null
;
}
yield
return
new
WaitForSeconds
(
0.01f
);
if
(
isRowDeleting
[
top
+
1
])
{
...
...
@@ -513,6 +534,11 @@ public class MapManager : MonoBehaviour {
{
while
(!
isTetriminoFalling
)
{
while
(
GameManager
.
gameState
==
GameState
.
Portal
)
{
tetriminoCreatedTime
+=
Time
.
deltaTime
;
yield
return
null
;
}
yield
return
new
WaitForSeconds
(
0.1f
);
tetriminoWaitedTime
=
Time
.
time
-
tetriminoCreatedTime
;
}
...
...
@@ -636,6 +662,10 @@ public class MapManager : MonoBehaviour {
{
while
(
te
.
transform
.
position
.
y
>
tetrisYCoord
[(
int
)
te
.
mapCoord
.
y
])
{
while
(
GameManager
.
gameState
==
GameState
.
Portal
)
{
yield
return
null
;
}
yield
return
new
WaitForSeconds
(
0.01f
);
fallTime
=
Time
.
time
-
initialFallTime
;
fallSpeed
+=
gravity
*
fallTime
*
fallTime
;
...
...
@@ -819,6 +849,8 @@ public class MapManager : MonoBehaviour {
float
alpha
=
1
;
for
(
int
i
=
0
;
i
<
20
;
i
++)
{
if
(
i
==
6
)
isDoorClosing
=
false
;
yield
return
new
WaitForSeconds
(
0.01f
);
room
.
leftTetrisDoor
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
alpha
);
room
.
rightTetrisDoor
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
alpha
);
...
...
@@ -828,7 +860,6 @@ public class MapManager : MonoBehaviour {
room
.
leftTetrisDoor
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
0
);
room
.
rightTetrisDoor
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
0
);
room
.
fog
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
0
);
isDoorClosing
=
false
;
}
/// <summary>
/// Make room fade out.
...
...
@@ -850,10 +881,9 @@ public class MapManager : MonoBehaviour {
room
.
rightTetrisDoor
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
1
);
room
.
fog
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
1
);
}
/// <summary>
/// Control portal's move.
/// </summary>
public
void
PortalControl
()
{
int
minDifference
=
100
;
...
...
Assets/Scripts/TetrisMap/Portal.cs
View file @
be57d90b
...
...
@@ -7,7 +7,9 @@ public class Portal : MonoBehaviour {
private
void
OnTriggerStay2D
(
Collider2D
collision
)
{
if
(
collision
.
tag
.
Equals
(
"Player"
)
&&
Input
.
GetKeyDown
(
KeyCode
.
F
))
{
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Portal
));
}
}
// Use this for initialization
...
...
Assets/Scripts/TetrisMap/Room.cs
View file @
be57d90b
...
...
@@ -384,7 +384,21 @@ public class Room : MonoBehaviour
fog
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
0
);
CreatePortal
();
if
(
isPortal
==
true
)
{
for
(
int
x
=
0
;
x
<
MapManager
.
width
;
x
++)
MapManager
.
portalDistributedHorizontal
[
x
].
Clear
();
for
(
int
y
=
0
;
y
<=
MapManager
.
realHeight
;
y
++)
MapManager
.
portalDistributedVertical
[
y
].
Clear
();
for
(
int
x
=
0
;
x
<
MapManager
.
width
;
x
++)
for
(
int
y
=
0
;
y
<=
MapManager
.
realHeight
;
y
++)
if
(
MapManager
.
mapGrid
[
x
,
y
]
!=
null
&&
MapManager
.
mapGrid
[
x
,
y
].
isPortal
==
true
)
{
MapManager
.
portalGrid
[
x
,
y
]
=
true
;
MapManager
.
portalDistributedHorizontal
[
x
].
Add
(
y
);
MapManager
.
portalDistributedVertical
[
y
].
Add
(
x
);
}
portalSurface
=
Instantiate
(
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
portalSurface
,
transform
.
position
+
new
Vector3
(
12
,
12
,
0
),
Quaternion
.
identity
,
transform
);
}
isRoomCleared
=
true
;
if
(
specialRoomType
==
RoomType
.
Boss
)
MapManager
.
currentStage
+=
1
;
...
...
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