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
890fb3b1
Commit
890fb3b1
authored
Jan 31, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
인풋 좀 고치고 인벤토리 끄고 키는 기능 만듬
parent
ba6bce1a
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
526 additions
and
240 deletions
+526
-240
Player.prefab
Assets/Prefabs/Characters/Player.prefab
+5
-5
GameManager.prefab
Assets/Prefabs/GameManager.prefab
+2
-2
TestTools.prefab
Assets/Prefabs/TetrisMap/TestTools.prefab
+155
-1
GameOverScreen.prefab
Assets/Prefabs/UI/GameOverScreen.prefab
+1
-1
PlayScene.unity
Assets/Scenes/PlayScene.unity
+319
-201
GameManager.cs
Assets/Scripts/GameManager.cs
+31
-9
MapManager.cs
Assets/Scripts/TetrisMap/MapManager.cs
+13
-13
Test.cs
Assets/Scripts/TetrisMap/Test.cs
+0
-8
No files found.
Assets/Prefabs/Characters/Player.prefab
View file @
890fb3b1
...
...
@@ -91,7 +91,7 @@ Rigidbody2D:
m_Mass
:
1
m_LinearDrag
:
0
m_AngularDrag
:
0.05
m_GravityScale
:
5
m_GravityScale
:
3
m_Material
:
{
fileID
:
0
}
m_Interpolate
:
1
m_SleepingMode
:
1
...
...
@@ -239,9 +239,9 @@ MonoBehaviour:
comboTime
:
1
time
:
{
fileID
:
0
}
combo
:
{
fileID
:
0
}
comboArray
:
comboArray
:
AB
StartTime
:
0
anim
:
{
fileID
:
0
}
anim
:
{
fileID
:
95992411616135034
}
aoc
:
{
fileID
:
0
}
normalAttack
:
-
{
fileID
:
7400000
,
guid
:
be4bdbaff27cc7c46a79b3ef4e1fe3f6
,
type
:
2
}
...
...
@@ -260,7 +260,7 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
LCUI
:
{
fileID
:
0
}
ttx
:
0
ttx
:
8
tty
:
0
---
!u!212
&212187280661781960
SpriteRenderer
:
...
...
@@ -297,7 +297,7 @@ SpriteRenderer:
m_SortingLayerID
:
-2078941185
m_SortingLayer
:
7
m_SortingOrder
:
0
m_Sprite
:
{
fileID
:
21300000
,
guid
:
bae70a52c1619cd478cb9d32f0cb7083
,
type
:
3
}
m_Sprite
:
{
fileID
:
21300000
,
guid
:
92d166e0c2a85a14facee45f5a5a8444
,
type
:
3
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_FlipX
:
0
m_FlipY
:
0
...
...
Assets/Prefabs/GameManager.prefab
View file @
890fb3b1
...
...
@@ -51,5 +51,5 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
97912f0a2214a8a4f8023ed30629bb30
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
gameOver
Screen
:
{
fileID
:
223237664237935382
,
guid
:
692aad2449e06054799ea4706578fb23
,
type
:
2
}
gameOver
Canvas
:
{
fileID
:
0
}
inventoryCanvas
:
{
fileID
:
0
}
Assets/Prefabs/TetrisMap/TestTools.prefab
View file @
890fb3b1
...
...
@@ -11,6 +11,23 @@ Prefab:
m_SourcePrefab
:
{
fileID
:
0
}
m_RootGameObject
:
{
fileID
:
1083421967201116
}
m_IsPrefabAsset
:
1
---
!u!1
&1039579742201942
GameObject
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
224687987329766264
}
-
component
:
{
fileID
:
222926987001539654
}
-
component
:
{
fileID
:
114089210082657912
}
m_Layer
:
5
m_Name
:
comboString
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!1
&1083421967201116
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -79,6 +96,23 @@ GameObject:
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!1
&1222494079920298
GameObject
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
224707923182581972
}
-
component
:
{
fileID
:
222126209999432066
}
-
component
:
{
fileID
:
114917269459606026
}
m_Layer
:
5
m_Name
:
comboTime
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!1
&1227515685001158
GameObject
:
m_ObjectHideFlags
:
1
...
...
@@ -330,6 +364,41 @@ MonoBehaviour:
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
---
!u!114
&114089210082657912
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1039579742201942
}
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.19607843
,
g
:
0.19607843
,
b
:
0.19607843
,
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
:
14
m_FontStyle
:
0
m_BestFit
:
0
m_MinSize
:
10
m_MaxSize
:
40
m_Alignment
:
0
m_AlignByGeometry
:
0
m_RichText
:
1
m_HorizontalOverflow
:
0
m_VerticalOverflow
:
0
m_LineSpacing
:
1
m_Text
:
'
test
'
---
!u!114
&114197899296498466
MonoBehaviour
:
m_ObjectHideFlags
:
1
...
...
@@ -798,7 +867,7 @@ MonoBehaviour:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
114213890665286158
}
m_MethodName
:
ClearRoom
m_MethodName
:
UpgradeStage
m_Mode
:
1
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
...
...
@@ -897,6 +966,46 @@ MonoBehaviour:
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
---
!u!114
&114917269459606026
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1222494079920298
}
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.19607843
,
g
:
0.19607843
,
b
:
0.19607843
,
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
:
14
m_FontStyle
:
0
m_BestFit
:
0
m_MinSize
:
10
m_MaxSize
:
40
m_Alignment
:
0
m_AlignByGeometry
:
0
m_RichText
:
1
m_HorizontalOverflow
:
0
m_VerticalOverflow
:
0
m_LineSpacing
:
1
m_Text
:
New Text
---
!u!222
&222126209999432066
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1222494079920298
}
m_CullTransparentMesh
:
0
---
!u!222
&222204035592807254
CanvasRenderer
:
m_ObjectHideFlags
:
1
...
...
@@ -967,6 +1076,13 @@ CanvasRenderer:
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1161693701796258
}
m_CullTransparentMesh
:
0
---
!u!222
&222926987001539654
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1039579742201942
}
m_CullTransparentMesh
:
0
---
!u!222
&222977622312510518
CanvasRenderer
:
m_ObjectHideFlags
:
1
...
...
@@ -1065,6 +1181,8 @@ RectTransform:
-
{
fileID
:
224071041299093070
}
-
{
fileID
:
224667404527337120
}
-
{
fileID
:
224008356030171754
}
-
{
fileID
:
224687987329766264
}
-
{
fileID
:
224707923182581972
}
m_Father
:
{
fileID
:
4884929250924374
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
...
...
@@ -1184,6 +1302,42 @@ RectTransform:
m_AnchoredPosition
:
{
x
:
190
,
y
:
210
}
m_SizeDelta
:
{
x
:
200
,
y
:
50
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224687987329766264
RectTransform
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1039579742201942
}
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
:
224395958577644168
}
m_RootOrder
:
6
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
:
100
,
y
:
100
}
m_SizeDelta
:
{
x
:
160
,
y
:
30
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224707923182581972
RectTransform
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1222494079920298
}
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
:
224395958577644168
}
m_RootOrder
:
7
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
:
100
,
y
:
120
}
m_SizeDelta
:
{
x
:
160
,
y
:
30
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224747592117556546
RectTransform
:
m_ObjectHideFlags
:
1
...
...
Assets/Prefabs/UI/GameOverScreen.prefab
View file @
890fb3b1
...
...
@@ -97,7 +97,7 @@ GameObject:
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
0
m_IsActive
:
1
---
!u!114
&114217847818790192
MonoBehaviour
:
m_ObjectHideFlags
:
1
...
...
Assets/Scenes/PlayScene.unity
View file @
890fb3b1
This diff is collapsed.
Click to expand it.
Assets/Scripts/GameManager.cs
View file @
890fb3b1
...
...
@@ -11,11 +11,12 @@ public class GameManager : MonoBehaviour {
/// </summary>
public
static
GameState
gameState
;
public
Canvas
gameOverScreen
;
public
Canvas
gameOverCanvas
;
public
Canvas
inventoryCanvas
;
public
void
RestartGame
()
{
gameOver
Screen
.
gameObject
.
SetActive
(
false
);
gameOver
Canvas
.
gameObject
.
SetActive
(
false
);
SceneManager
.
LoadScene
(
SceneManager
.
GetActiveScene
().
name
);
}
...
...
@@ -45,7 +46,20 @@ public class GameManager : MonoBehaviour {
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Ingame
));
}
}
if
(
Input
.
GetKeyDown
(
KeyCode
.
F
))
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
I
))
{
if
(
gameState
==
GameState
.
Ingame
)
{
inventoryCanvas
.
gameObject
.
SetActive
(
true
);
gameState
=
GameState
.
Inventory
;
}
else
if
(
gameState
==
GameState
.
Inventory
)
{
inventoryCanvas
.
gameObject
.
SetActive
(
false
);
gameState
=
GameState
.
Ingame
;
}
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
F
))
{
if
(
gameState
==
GameState
.
Portal
&&
MapManager
.
currentRoom
!=
MapManager
.
mapGrid
[(
int
)
MapManager
.
portalDestination
.
x
,
(
int
)
MapManager
.
portalDestination
.
y
])
{
...
...
@@ -56,18 +70,26 @@ public class GameManager : MonoBehaviour {
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Ingame
));
}
}
if
(
Input
.
GetKeyDown
(
KeyCode
.
Escape
))
else
if
(
Input
.
GetButtonDown
(
"Cancel"
))
{
if
(
gameState
==
GameState
.
Portal
)
{
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
));
}
else
if
(
gameState
==
GameState
.
Inventory
)
{
inventoryCanvas
.
gameObject
.
SetActive
(
false
);
gameState
=
GameState
.
Ingame
;
}
}
}
if
(
gameState
==
GameState
.
GameOver
)
{
if
(
gameOver
Screen
.
isActiveAndEnabled
==
false
)
if
(
gameOver
Canvas
.
isActiveAndEnabled
==
false
)
Debug
.
Log
(
"Game Over"
);
gameOver
Screen
.
gameObject
.
SetActive
(
true
);
gameOver
Canvas
.
gameObject
.
SetActive
(
true
);
}
}
}
Assets/Scripts/TetrisMap/MapManager.cs
View file @
890fb3b1
...
...
@@ -699,19 +699,19 @@ public class MapManager : MonoBehaviour {
/// <param name="te">Tetrimino you want to move.</param>
public
void
TetriminoControl
(
Tetrimino
te
)
{
if
((
Input
.
GetKeyDown
(
KeyCode
.
Space
)
&&
GameManager
.
gameState
==
GameState
.
Tetris
)
||
tetriminoWaitedTime
>
timeToFallTetrimino
)
if
((
Input
.
GetKeyDown
(
KeyCode
.
Space
)
&&
GameManager
.
gameState
==
GameState
.
Tetris
)
||
tetriminoWaitedTime
>
timeToFallTetrimino
)
{
isTetriminoFalling
=
true
;
TetriminoMapCoordDown
(
currentTetrimino
);
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
LeftArrow
)
&&
GameManager
.
gameState
==
GameState
.
Tetris
)
MoveTetriminoHorizontal
(
currentTetrimino
,
new
Vector3
(-
1
,
0
,
0
));
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
RightArrow
)
&&
GameManager
.
gameState
==
GameState
.
Tetris
)
MoveTetriminoHorizontal
(
currentTetrimino
,
new
Vector3
(
1
,
0
,
0
));
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
UpArrow
)
&&
GameManager
.
gameState
==
GameState
.
Tetris
)
TetriminoRotate
(
currentTetrimino
,
1
);
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
DownArrow
)
&&
GameManager
.
gameState
==
GameState
.
Tetris
)
TetriminoRotate
(
currentTetrimino
,
-
1
);
if
(
GameManager
.
gameState
==
GameState
.
Tetris
)
{
if
(
Input
.
GetButtonDown
(
"Vertical"
))
TetriminoRotate
(
currentTetrimino
,
(
int
)
Input
.
GetAxisRaw
(
"Vertical"
));
else
if
(
Input
.
GetButtonDown
(
"Horizontal"
))
MoveTetriminoHorizontal
(
currentTetrimino
,
new
Vector3
((
int
)
Input
.
GetAxisRaw
(
"Horizontal"
),
0
,
0
));
}
}
/// <summary>
/// Set rooms' mapCoord on this tetrimino.
...
...
@@ -889,7 +889,7 @@ public class MapManager : MonoBehaviour {
int
minDifference
=
100
;
int
difference
=
0
;
Vector2
tempDestination
=
new
Vector2
(
0
,
0
);
if
(
Input
.
Get
KeyDown
(
KeyCode
.
UpArrow
)
)
if
(
Input
.
Get
ButtonDown
(
"Vertical"
)
&&
Input
.
GetAxisRaw
(
"Vertical"
)
>
0
)
for
(
int
i
=
(
int
)
portalDestination
.
y
+
1
;
i
<
realHeight
+
1
;
i
++)
{
if
(
portalDistributedVertical
[
i
].
Count
!=
0
)
...
...
@@ -909,7 +909,7 @@ public class MapManager : MonoBehaviour {
return
;
}
}
else
if
(
Input
.
Get
KeyDown
(
KeyCode
.
DownArrow
)
)
else
if
(
Input
.
Get
ButtonDown
(
"Vertical"
)
&&
Input
.
GetAxisRaw
(
"Vertical"
)
<
0
)
for
(
int
i
=
(
int
)
portalDestination
.
y
-
1
;
i
>=
0
;
i
--)
{
if
(
portalDistributedVertical
[
i
].
Count
!=
0
)
...
...
@@ -929,7 +929,7 @@ public class MapManager : MonoBehaviour {
return
;
}
}
else
if
(
Input
.
Get
KeyDown
(
KeyCode
.
LeftArrow
)
)
else
if
(
Input
.
Get
ButtonDown
(
"Horizontal"
)
&&
Input
.
GetAxisRaw
(
"Horizontal"
)
<
0
)
for
(
int
i
=
(
int
)
portalDestination
.
x
-
1
;
i
>=
0
;
i
--)
{
if
(
portalDistributedHorizontal
[
i
].
Count
!=
0
)
...
...
@@ -949,7 +949,7 @@ public class MapManager : MonoBehaviour {
return
;
}
}
else
if
(
Input
.
Get
KeyDown
(
KeyCode
.
RightArrow
)
)
else
if
(
Input
.
Get
ButtonDown
(
"Horizontal"
)
&&
Input
.
GetAxisRaw
(
"Horizontal"
)
>
0
)
for
(
int
i
=
(
int
)
portalDestination
.
x
+
1
;
i
<
width
;
i
++)
{
if
(
portalDistributedHorizontal
[
i
].
Count
!=
0
)
...
...
Assets/Scripts/TetrisMap/Test.cs
View file @
890fb3b1
...
...
@@ -125,13 +125,5 @@ public class Test : MonoBehaviour {
SpawnBossTetrimino
();
if
(!
MapManager
.
isTetriminoFalling
)
Timer
();
/*if (Input.GetKeyDown(KeyCode.Tab) && GameManager.gameState != GameManager.GameState.Tetris)
{
GameManager.gameState = GameManager.GameState.Tetris;
GameObject.Find("Main Camera").transform.position = tetrisCameraCoord;
GameObject.Find("Main Camera").GetComponent<Camera>().orthographicSize = tetrisMapSize;
}
else if (Input.GetKeyDown(KeyCode.Tab) && GameManager.gameState == GameManager.GameState.Tetris)
GameManager.gameState = GameManager.GameState.Ingame;*/
}
}
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