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
f38d8a10
Commit
f38d8a10
authored
Feb 04, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
인풋 일부랑 코드 정리 함
parent
f830a09e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
123 additions
and
370 deletions
+123
-370
EnemyManager.prefab
Assets/Prefabs/EnemyManager.prefab
+17
-1
TestTools.prefab
Assets/Prefabs/TetrisMap/TestTools.prefab
+3
-202
SwapTile.cs
Assets/Scripts/SwapTile.cs
+0
-109
SwapTile.cs.meta
Assets/Scripts/SwapTile.cs.meta
+0
-11
MapManager.cs
Assets/Scripts/TetrisMap/MapManager.cs
+23
-4
Portal.cs
Assets/Scripts/TetrisMap/Portal.cs
+1
-1
Room.cs
Assets/Scripts/TetrisMap/Room.cs
+3
-11
Test.cs
Assets/Scripts/TetrisMap/Test.cs
+1
-1
TileManager.cs
Assets/Scripts/TileManager.cs
+43
-30
InputManager.asset
ProjectSettings/InputManager.asset
+32
-0
No files found.
Assets/Prefabs/EnemyManager.prefab
View file @
f38d8a10
...
@@ -53,6 +53,22 @@ MonoBehaviour:
...
@@ -53,6 +53,22 @@ MonoBehaviour:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
player
:
{
fileID
:
1623439448163086
,
guid
:
3d077a5f727dd1e4780e9265ed26e036
,
type
:
2
}
player
:
{
fileID
:
1623439448163086
,
guid
:
3d077a5f727dd1e4780e9265ed26e036
,
type
:
2
}
dropTableData
:
{
fileID
:
4900000
,
guid
:
6216895c658a2af40890a4446cc10a8c
,
type
:
3
}
dropTableData
:
{
fileID
:
4900000
,
guid
:
6216895c658a2af40890a4446cc10a8c
,
type
:
3
}
dropItemList
:
[]
dropItemList
:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
enemyPrefab
:
enemyPrefab
:
-
{
fileID
:
1636491341446076
,
guid
:
a164c147037e89448820f7387c724c42
,
type
:
2
}
-
{
fileID
:
1636491341446076
,
guid
:
a164c147037e89448820f7387c724c42
,
type
:
2
}
Assets/Prefabs/TetrisMap/TestTools.prefab
View file @
f38d8a10
...
@@ -254,24 +254,6 @@ GameObject:
...
@@ -254,24 +254,6 @@ GameObject:
m_NavMeshLayer
:
0
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
m_IsActive
:
1
---
!u!1
&1501351517308982
GameObject
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
224667404527337120
}
-
component
:
{
fileID
:
222231136650734454
}
-
component
:
{
fileID
:
114573939713302164
}
-
component
:
{
fileID
:
114685218848006942
}
m_Layer
:
5
m_Name
:
Change Tile
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!1
&1553155786573832
---
!u!1
&1553155786573832
GameObject
:
GameObject
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
...
@@ -307,23 +289,6 @@ GameObject:
...
@@ -307,23 +289,6 @@ GameObject:
m_NavMeshLayer
:
0
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
m_IsActive
:
1
---
!u!1
&1944793276666558
GameObject
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
224543215425431206
}
-
component
:
{
fileID
:
222419263267172472
}
-
component
:
{
fileID
:
114605948540917444
}
m_Layer
:
5
m_Name
:
Text
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!1
&1971012999897000
---
!u!1
&1971012999897000
GameObject
:
GameObject
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
...
@@ -904,66 +869,6 @@ MonoBehaviour:
...
@@ -904,66 +869,6 @@ MonoBehaviour:
m_FillAmount
:
1
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
m_FillOrigin
:
0
---
!u!114
&114573939713302164
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1501351517308982
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
-765806418
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
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_Sprite
:
{
fileID
:
10905
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_Type
:
1
m_PreserveAspect
:
0
m_FillCenter
:
1
m_FillMethod
:
4
m_FillAmount
:
1
m_FillClockwise
:
1
m_FillOrigin
:
0
---
!u!114
&114605948540917444
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1944793276666558
}
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
:
4
m_AlignByGeometry
:
0
m_RichText
:
1
m_HorizontalOverflow
:
0
m_VerticalOverflow
:
0
m_LineSpacing
:
1
m_Text
:
Change Tile
---
!u!114
&114644241248038864
---
!u!114
&114644241248038864
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
...
@@ -1065,58 +970,6 @@ MonoBehaviour:
...
@@ -1065,58 +970,6 @@ MonoBehaviour:
m_BlockingMask
:
m_BlockingMask
:
serializedVersion
:
2
serializedVersion
:
2
m_Bits
:
4294967295
m_Bits
:
4294967295
---
!u!114
&114685218848006942
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1501351517308982
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
1392445389
,
guid
:
f70555f144d8491a825f0804e09c671c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Navigation
:
m_Mode
:
3
m_SelectOnUp
:
{
fileID
:
0
}
m_SelectOnDown
:
{
fileID
:
0
}
m_SelectOnLeft
:
{
fileID
:
0
}
m_SelectOnRight
:
{
fileID
:
0
}
m_Transition
:
1
m_Colors
:
m_NormalColor
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_HighlightedColor
:
{
r
:
0.9607843
,
g
:
0.9607843
,
b
:
0.9607843
,
a
:
1
}
m_PressedColor
:
{
r
:
0.78431374
,
g
:
0.78431374
,
b
:
0.78431374
,
a
:
1
}
m_DisabledColor
:
{
r
:
0.78431374
,
g
:
0.78431374
,
b
:
0.78431374
,
a
:
0.5019608
}
m_ColorMultiplier
:
1
m_FadeDuration
:
0.1
m_SpriteState
:
m_HighlightedSprite
:
{
fileID
:
0
}
m_PressedSprite
:
{
fileID
:
0
}
m_DisabledSprite
:
{
fileID
:
0
}
m_AnimationTriggers
:
m_NormalTrigger
:
Normal
m_HighlightedTrigger
:
Highlighted
m_PressedTrigger
:
Pressed
m_DisabledTrigger
:
Disabled
m_Interactable
:
1
m_TargetGraphic
:
{
fileID
:
114573939713302164
}
m_OnClick
:
m_PersistentCalls
:
m_Calls
:
-
m_Target
:
{
fileID
:
114213890665286158
}
m_MethodName
:
ChangeTile
m_Mode
:
1
m_Arguments
:
m_ObjectArgument
:
{
fileID
:
0
}
m_ObjectArgumentAssemblyTypeName
:
UnityEngine.Object, UnityEngine
m_IntArgument
:
0
m_FloatArgument
:
0
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
m_TypeName
:
UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
---
!u!114
&114745293325452964
---
!u!114
&114745293325452964
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
...
@@ -1296,13 +1149,6 @@ CanvasRenderer:
...
@@ -1296,13 +1149,6 @@ CanvasRenderer:
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1202151931231562
}
m_GameObject
:
{
fileID
:
1202151931231562
}
m_CullTransparentMesh
:
0
m_CullTransparentMesh
:
0
---
!u!222
&222231136650734454
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1501351517308982
}
m_CullTransparentMesh
:
0
---
!u!222
&222315919489052834
---
!u!222
&222315919489052834
CanvasRenderer
:
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
...
@@ -1324,13 +1170,6 @@ CanvasRenderer:
...
@@ -1324,13 +1170,6 @@ CanvasRenderer:
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1202478807913418
}
m_GameObject
:
{
fileID
:
1202478807913418
}
m_CullTransparentMesh
:
0
m_CullTransparentMesh
:
0
---
!u!222
&222419263267172472
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1944793276666558
}
m_CullTransparentMesh
:
0
---
!u!222
&222432832272465880
---
!u!222
&222432832272465880
CanvasRenderer
:
CanvasRenderer
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
...
@@ -1439,7 +1278,7 @@ RectTransform:
...
@@ -1439,7 +1278,7 @@ RectTransform:
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
224395958577644168
}
m_Father
:
{
fileID
:
224395958577644168
}
m_RootOrder
:
7
m_RootOrder
:
6
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
1
}
m_AnchorMin
:
{
x
:
0
,
y
:
1
}
m_AnchorMax
:
{
x
:
0
,
y
:
1
}
m_AnchorMax
:
{
x
:
0
,
y
:
1
}
...
@@ -1531,7 +1370,7 @@ RectTransform:
...
@@ -1531,7 +1370,7 @@ RectTransform:
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
224395958577644168
}
m_Father
:
{
fileID
:
224395958577644168
}
m_RootOrder
:
9
m_RootOrder
:
8
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
...
@@ -1554,7 +1393,6 @@ RectTransform:
...
@@ -1554,7 +1393,6 @@ RectTransform:
-
{
fileID
:
224071041299093070
}
-
{
fileID
:
224071041299093070
}
-
{
fileID
:
224804297962416264
}
-
{
fileID
:
224804297962416264
}
-
{
fileID
:
224036569745634590
}
-
{
fileID
:
224036569745634590
}
-
{
fileID
:
224667404527337120
}
-
{
fileID
:
224008356030171754
}
-
{
fileID
:
224008356030171754
}
-
{
fileID
:
224718253185442684
}
-
{
fileID
:
224718253185442684
}
-
{
fileID
:
224363839195006936
}
-
{
fileID
:
224363839195006936
}
...
@@ -1621,24 +1459,6 @@ RectTransform:
...
@@ -1621,24 +1459,6 @@ RectTransform:
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224543215425431206
RectTransform
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1944793276666558
}
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
:
224667404527337120
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0
}
m_AnchorMax
:
{
x
:
1
,
y
:
1
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224612213790397690
---
!u!224
&224612213790397690
RectTransform
:
RectTransform
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
...
@@ -1676,25 +1496,6 @@ RectTransform:
...
@@ -1676,25 +1496,6 @@ RectTransform:
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_AnchoredPosition
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_SizeDelta
:
{
x
:
0
,
y
:
0
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224667404527337120
RectTransform
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1501351517308982
}
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
:
-
{
fileID
:
224543215425431206
}
m_Father
:
{
fileID
:
224395958577644168
}
m_RootOrder
:
6
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
-300
,
y
:
350
}
m_SizeDelta
:
{
x
:
200
,
y
:
50
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!224
&224718253185442684
---
!u!224
&224718253185442684
RectTransform
:
RectTransform
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
...
@@ -1706,7 +1507,7 @@ RectTransform:
...
@@ -1706,7 +1507,7 @@ RectTransform:
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
224395958577644168
}
m_Father
:
{
fileID
:
224395958577644168
}
m_RootOrder
:
8
m_RootOrder
:
7
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
...
...
Assets/Scripts/SwapTile.cs
deleted
100644 → 0
View file @
f830a09e
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.Tilemaps
;
public
class
SwapTile
:
MonoBehaviour
{
public
TileBase
[]
tileFR
;
public
TileBase
[]
tileIT
;
public
TileBase
[]
tileWW
;
public
TileBase
[]
tileUT
;
public
Tilemap
map
;
public
RoomInGame
roomInGame
;
public
TileBase
[]
fillLeftDoor
;
public
TileBase
[]
fillRightDoor
;
//기본 테마를 숲속 유적으로 하고 if(얼음신전)
public
void
Init
()
{
for
(
int
i
=
0
;
i
<
tileFR
.
Length
;
i
++)
map
.
SwapTile
(
tileFR
[
i
],
tileIT
[
i
]);
}
/*
같은 방식으로
if(수로)
for(int i=0;i<tileFR.Length;i++)
map.SwapTile(tileFR[i], tileWW[i]);
if(나무아래)
for(int i=0;i<tileFR.Length;i++)
map.SwapTile(tileFR[i], tileUT[i]);
*/
public
void
FillEmptyDoor
(
int
leftDoorLocation
,
int
rightDoorLocation
)
{
Tilemap
outerWallMap
=
roomInGame
.
transform
.
GetChild
(
4
).
GetComponent
<
Tilemap
>();
int
[]
doorLocations
=
{
1
,
9
,
17
};
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
//경우를 따지자
/*
* 왼쪽의 경우
* 문 위 타일
* 1. 오른쪽에 타일이 없음 -> [| |] 모양 넣기 0
* 2. 오른쪽에만 타일이 있음 -> [| .] 모양 넣기 2
* 3. 오른쪽이랑 오른쪽 대각선 위에 타일이 있음 -> [| ] 모양 넣기 1
*
* 문 아래 타일
* 1. 오른쪽 타일 없음 -> 문 위랑 동일
* 2. 오른족에만 타일 -> [| '] 모양 넣기 3
* 3. 오른족이랑 오른쪽 대각선 아래에 타일 -> [| ] 모양
*
* 오른쪽의 경우
* 문 위 타일
* 1. 왼쪽에 X -> [| |]
* 2. 왼쪽에만 -> [. |]
* 3. 왼쪽이랑 왼쪽 대각선 아래 -> [ |]
*
* 문 아래
* 1. 왼쪽에 X -> [| |]
* 2. 왼쪽에만 -> [' |]
* 3. 왼쪽이랑 왼쪽 대각선 위 -> [ |]
*/
if
(
i
!=
leftDoorLocation
)
{
outerWallMap
.
SetTile
(
new
Vector3Int
(
0
,
doorLocations
[
i
]
+
1
,
0
),
fillLeftDoor
[
0
]);
outerWallMap
.
SetTile
(
new
Vector3Int
(
0
,
doorLocations
[
i
],
0
),
fillLeftDoor
[
0
]);
if
(
outerWallMap
.
HasTile
(
new
Vector3Int
(
1
,
doorLocations
[
i
]
+
2
,
0
))
&&
outerWallMap
.
HasTile
(
new
Vector3Int
(
1
,
doorLocations
[
i
]
+
3
,
0
)))
outerWallMap
.
SetTile
(
new
Vector3Int
(
0
,
doorLocations
[
i
]
+
2
,
0
),
fillLeftDoor
[
1
]);
else
if
(
outerWallMap
.
HasTile
(
new
Vector3Int
(
1
,
doorLocations
[
i
]
+
2
,
0
)))
outerWallMap
.
SetTile
(
new
Vector3Int
(
0
,
doorLocations
[
i
]
+
2
,
0
),
fillLeftDoor
[
2
]);
else
outerWallMap
.
SetTile
(
new
Vector3Int
(
0
,
doorLocations
[
i
]
+
2
,
0
),
fillLeftDoor
[
0
]);
if
(
outerWallMap
.
HasTile
(
new
Vector3Int
(
1
,
doorLocations
[
i
]
-
1
,
0
))
&&
outerWallMap
.
HasTile
(
new
Vector3Int
(
1
,
doorLocations
[
i
]
-
2
,
0
)))
outerWallMap
.
SetTile
(
new
Vector3Int
(
0
,
doorLocations
[
i
]
-
1
,
0
),
fillLeftDoor
[
1
]);
else
if
(
outerWallMap
.
HasTile
(
new
Vector3Int
(
1
,
doorLocations
[
i
]
-
1
,
0
)))
outerWallMap
.
SetTile
(
new
Vector3Int
(
0
,
doorLocations
[
i
]
-
1
,
0
),
fillLeftDoor
[
3
]);
else
outerWallMap
.
SetTile
(
new
Vector3Int
(
0
,
doorLocations
[
i
]
-
1
,
0
),
fillLeftDoor
[
0
]);
}
if
(
i
!=
rightDoorLocation
)
{
outerWallMap
.
SetTile
(
new
Vector3Int
(
23
,
doorLocations
[
i
]
+
1
,
0
),
fillRightDoor
[
0
]);
outerWallMap
.
SetTile
(
new
Vector3Int
(
23
,
doorLocations
[
i
],
0
),
fillRightDoor
[
0
]);
if
(
outerWallMap
.
HasTile
(
new
Vector3Int
(
22
,
doorLocations
[
i
]
+
2
,
0
))
&&
outerWallMap
.
HasTile
(
new
Vector3Int
(
22
,
doorLocations
[
i
]
+
3
,
0
)))
outerWallMap
.
SetTile
(
new
Vector3Int
(
23
,
doorLocations
[
i
]
+
2
,
0
),
fillRightDoor
[
1
]);
else
if
(
outerWallMap
.
HasTile
(
new
Vector3Int
(
22
,
doorLocations
[
i
]
+
2
,
0
)))
outerWallMap
.
SetTile
(
new
Vector3Int
(
23
,
doorLocations
[
i
]
+
2
,
0
),
fillRightDoor
[
2
]);
else
outerWallMap
.
SetTile
(
new
Vector3Int
(
23
,
doorLocations
[
i
]
+
2
,
0
),
fillRightDoor
[
0
]);
if
(
outerWallMap
.
HasTile
(
new
Vector3Int
(
22
,
doorLocations
[
i
]
-
1
,
0
))
&&
outerWallMap
.
HasTile
(
new
Vector3Int
(
22
,
doorLocations
[
i
]
-
2
,
0
)))
outerWallMap
.
SetTile
(
new
Vector3Int
(
23
,
doorLocations
[
i
]
-
1
,
0
),
fillRightDoor
[
1
]);
else
if
(
outerWallMap
.
HasTile
(
new
Vector3Int
(
22
,
doorLocations
[
i
]
-
1
,
0
)))
outerWallMap
.
SetTile
(
new
Vector3Int
(
23
,
doorLocations
[
i
]
-
1
,
0
),
fillRightDoor
[
3
]);
else
outerWallMap
.
SetTile
(
new
Vector3Int
(
23
,
doorLocations
[
i
]
-
1
,
0
),
fillRightDoor
[
0
]);
}
}
}
}
Assets/Scripts/SwapTile.cs.meta
deleted
100644 → 0
View file @
f830a09e
fileFormatVersion: 2
guid: 5ba206a8812470440974a2c8bd56ca6b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/TetrisMap/MapManager.cs
View file @
f38d8a10
...
@@ -216,6 +216,25 @@ public class MapManager : MonoBehaviour {
...
@@ -216,6 +216,25 @@ public class MapManager : MonoBehaviour {
* functions
* functions
* */
* */
/// <summary>
/// <summary>
/// Find and return object's child by child's name.
/// </summary>
/// <param name="parent">Parent object.</param>
/// <param name="name">Name of the child object you want to find.</param>
/// <returns></returns>
public
static
Transform
GetChildByName
(
Transform
parent
,
string
name
)
{
Transform
child
;
for
(
int
i
=
0
;
i
<
parent
.
childCount
;
i
++)
{
if
(
parent
.
GetChild
(
i
).
name
.
Equals
(
name
))
{
child
=
parent
.
GetChild
(
i
);
return
child
;
}
}
return
null
;
}
/// <summary>
/// Check if tetrimino is in right x coordinate.
/// Check if tetrimino is in right x coordinate.
/// </summary>
/// </summary>
/// <param name="te">-1 for over left end, 1 for over right end, 2 for over bottom end, 3 for already existing, 0 for right place.</param>
/// <param name="te">-1 for over left end, 1 for over right end, 2 for over bottom end, 3 for already existing, 0 for right place.</param>
...
@@ -711,14 +730,14 @@ public class MapManager : MonoBehaviour {
...
@@ -711,14 +730,14 @@ public class MapManager : MonoBehaviour {
}
}
if
(
GameManager
.
gameState
==
GameState
.
Tetris
)
if
(
GameManager
.
gameState
==
GameState
.
Tetris
)
{
{
if
(
Input
.
GetButtonDown
(
"Vertical"
))
if
(
Input
.
GetButtonDown
(
"
Tetrimino
Vertical"
))
{
{
TetriminoRotate
(
currentTetrimino
,
(
int
)
Input
.
GetAxisRaw
(
"Vertical"
));
TetriminoRotate
(
currentTetrimino
,
(
int
)
Input
.
GetAxisRaw
(
"
Tetrimino
Vertical"
));
}
}
else
if
(
Input
.
GetButtonDown
(
"Horizontal"
)
&&
lifeStoneManager
.
CountType
(
LifeStoneType
.
Gold
)
>
0
)
else
if
(
Input
.
GetButtonDown
(
"
Tetrimino
Horizontal"
)
&&
lifeStoneManager
.
CountType
(
LifeStoneType
.
Gold
)
>
0
)
{
{
MoveTetriminoHorizontal
(
currentTetrimino
,
new
Vector3
((
int
)
Input
.
GetAxisRaw
(
"Horizontal"
),
0
,
0
));
MoveTetriminoHorizontal
(
currentTetrimino
,
new
Vector3
((
int
)
Input
.
GetAxisRaw
(
"
Tetrimino
Horizontal"
),
0
,
0
));
lifeStoneManager
.
ChangeToNormal
(
LifeStoneType
.
Gold
,
tetriminoCost
);
lifeStoneManager
.
ChangeToNormal
(
LifeStoneType
.
Gold
,
tetriminoCost
);
}
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Space
)
&&
lifeStoneManager
.
CountType
(
LifeStoneType
.
Gold
)
>
0
)
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Space
)
&&
lifeStoneManager
.
CountType
(
LifeStoneType
.
Gold
)
>
0
)
...
...
Assets/Scripts/TetrisMap/Portal.cs
View file @
f38d8a10
...
@@ -6,7 +6,7 @@ public class Portal : MonoBehaviour {
...
@@ -6,7 +6,7 @@ public class Portal : MonoBehaviour {
private
void
OnTriggerStay2D
(
Collider2D
collision
)
private
void
OnTriggerStay2D
(
Collider2D
collision
)
{
{
if
(
collision
.
tag
.
Equals
(
"Player"
)
&&
Input
.
Get
KeyDown
(
KeyCode
.
F
))
if
(
collision
.
tag
.
Equals
(
"Player"
)
&&
Input
.
Get
ButtonDown
(
"Interaction"
))
{
{
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Portal
));
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
(
GameState
.
Portal
));
}
}
...
...
Assets/Scripts/TetrisMap/Room.cs
View file @
f38d8a10
...
@@ -120,15 +120,7 @@ public class Room : MonoBehaviour
...
@@ -120,15 +120,7 @@ public class Room : MonoBehaviour
public
void
CreateDoors
(
GameObject
_leftTetrisDoor
,
GameObject
_rightTetrisDoor
,
GameObject
_inGameDoorUp
,
GameObject
_inGameDoorDown
,
GameObject
_inGameDoorLeft
,
GameObject
_inGameDoorRight
)
public
void
CreateDoors
(
GameObject
_leftTetrisDoor
,
GameObject
_rightTetrisDoor
,
GameObject
_inGameDoorUp
,
GameObject
_inGameDoorDown
,
GameObject
_inGameDoorLeft
,
GameObject
_inGameDoorRight
)
{
{
float
standardSize
=
MapManager
.
tetrisMapSize
/
24
;
float
standardSize
=
MapManager
.
tetrisMapSize
/
24
;
Tilemap
wallTileMap
=
roomInGame
.
transform
.
GetChild
(
4
).
GetComponent
<
Tilemap
>();
Tilemap
wallTileMap
=
MapManager
.
GetChildByName
(
roomInGame
.
transform
,
"wall"
).
GetComponent
<
Tilemap
>();
for
(
int
i
=
0
;
i
<
roomInGame
.
transform
.
childCount
;
i
++)
{
if
(
roomInGame
.
transform
.
GetChild
(
i
).
name
.
Equals
(
"wall"
))
{
wallTileMap
=
roomInGame
.
transform
.
GetChild
(
i
).
GetComponent
<
Tilemap
>();
break
;
}
}
leftTetrisDoor
=
Instantiate
(
_leftTetrisDoor
,
transform
.
position
+
new
Vector3
(
standardSize
,
doorLocations
[
leftDoorLocation
],
0
),
Quaternion
.
identity
,
transform
);
leftTetrisDoor
=
Instantiate
(
_leftTetrisDoor
,
transform
.
position
+
new
Vector3
(
standardSize
,
doorLocations
[
leftDoorLocation
],
0
),
Quaternion
.
identity
,
transform
);
rightTetrisDoor
=
Instantiate
(
_rightTetrisDoor
,
transform
.
position
+
new
Vector3
(
standardSize
*
23
,
doorLocations
[
rightDoorLocation
],
0
),
Quaternion
.
identity
,
transform
);
rightTetrisDoor
=
Instantiate
(
_rightTetrisDoor
,
transform
.
position
+
new
Vector3
(
standardSize
*
23
,
doorLocations
[
rightDoorLocation
],
0
),
Quaternion
.
identity
,
transform
);
...
@@ -155,8 +147,8 @@ public class Room : MonoBehaviour
...
@@ -155,8 +147,8 @@ public class Room : MonoBehaviour
/// </summary>
/// </summary>
public
void
CreatePortal
()
public
void
CreatePortal
()
{
{
portal
=
roomInGame
.
transform
.
GetChild
(
roomInGame
.
transform
.
childCount
-
1
).
gameObject
;
GameObject
portal
=
MapManager
.
GetChildByName
(
roomInGame
.
transform
,
"Portal"
).
gameObject
;
if
(
specialRoomType
!=
RoomType
.
Normal
)
if
(
specialRoomType
!=
RoomType
.
Normal
)
{
{
portal
.
SetActive
(
true
);
portal
.
SetActive
(
true
);
isPortal
=
true
;
isPortal
=
true
;
...
...
Assets/Scripts/TetrisMap/Test.cs
View file @
f38d8a10
...
@@ -57,7 +57,7 @@ public class Test : MonoBehaviour {
...
@@ -57,7 +57,7 @@ public class Test : MonoBehaviour {
}
}
public
void
ChangeTile
()
public
void
ChangeTile
()
{
{
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
TileManager
>().
Change
AllTiles
(
MapManager
.
currentRoom
.
roomInGame
);
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
TileManager
>().
Set
AllTiles
(
MapManager
.
currentRoom
.
roomInGame
);
}
}
...
...
Assets/Scripts/TileManager.cs
View file @
f38d8a10
...
@@ -5,8 +5,14 @@ using UnityEngine.Tilemaps;
...
@@ -5,8 +5,14 @@ using UnityEngine.Tilemaps;
public
class
TileManager
:
MonoBehaviour
public
class
TileManager
:
MonoBehaviour
{
{
/// <summary>
/// Array of all tiles.
/// </summary>
public
TileBase
[]
allTiles
;
public
TileBase
[]
allTiles
;
/// <summary>
/// Dictionary for distributing all tiles.
/// Each dimensions for stage and concept.
/// </summary>
Dictionary
<
string
,
TileBase
>[,]
tilesDistributed
=
new
Dictionary
<
string
,
TileBase
>[
5
,
4
];
Dictionary
<
string
,
TileBase
>[,]
tilesDistributed
=
new
Dictionary
<
string
,
TileBase
>[
5
,
4
];
void
Awake
()
void
Awake
()
...
@@ -21,19 +27,14 @@ public class TileManager : MonoBehaviour
...
@@ -21,19 +27,14 @@ public class TileManager : MonoBehaviour
tilesDistributed
[
int
.
Parse
(
tileName
.
Substring
(
0
,
1
))
-
1
,
int
.
Parse
(
tileName
.
Substring
(
1
,
1
))
-
1
].
Add
(
tileName
.
Substring
(
2
),
allTiles
[
i
]);
tilesDistributed
[
int
.
Parse
(
tileName
.
Substring
(
0
,
1
))
-
1
,
int
.
Parse
(
tileName
.
Substring
(
1
,
1
))
-
1
].
Add
(
tileName
.
Substring
(
2
),
allTiles
[
i
]);
}
}
}
}
/// <summary>
/// Check room's tilemap's all position that if tile exists there or not.
/// </summary>
/// <param name="roomInGame">Room you want to check.</param>
public
void
CheckAllTiles
(
RoomInGame
roomInGame
)
public
void
CheckAllTiles
(
RoomInGame
roomInGame
)
{
{
Tilemap
roomTileMap
=
null
;
Tilemap
roomTileMap
=
MapManager
.
GetChildByName
(
roomInGame
.
transform
,
"wall"
).
GetComponent
<
Tilemap
>();
for
(
int
i
=
0
;
i
<
roomInGame
.
transform
.
childCount
;
i
++)
for
(
int
x
=
0
;
x
<
24
;
x
++)
{
if
(
roomInGame
.
transform
.
GetChild
(
i
).
name
.
Equals
(
"wall"
))
{
roomTileMap
=
roomInGame
.
transform
.
GetChild
(
i
).
GetComponent
<
Tilemap
>();
break
;
}
}
for
(
int
x
=
0
;
x
<
24
;
x
++)
for
(
int
y
=
0
;
y
<
24
;
y
++)
for
(
int
y
=
0
;
y
<
24
;
y
++)
{
{
if
(
roomTileMap
.
GetTile
(
new
Vector3Int
(
x
,
y
,
0
)))
if
(
roomTileMap
.
GetTile
(
new
Vector3Int
(
x
,
y
,
0
)))
...
@@ -42,7 +43,13 @@ public class TileManager : MonoBehaviour
...
@@ -42,7 +43,13 @@ public class TileManager : MonoBehaviour
roomInGame
.
tileInfo
[
x
,
y
]
=
false
;
roomInGame
.
tileInfo
[
x
,
y
]
=
false
;
}
}
}
}
/// <summary>
/// Check tile and set name for specified direction.
/// </summary>
/// <param name="roomInGame">Room you want to check.</param>
/// <param name="originPos">Position of tile map you want to check.</param>
/// <param name="checkPos">Direction you want to check.</param>
/// <returns></returns>
public
char
CheckQuarterTile
(
RoomInGame
roomInGame
,
Vector2Int
originPos
,
Vector2Int
checkPos
)
public
char
CheckQuarterTile
(
RoomInGame
roomInGame
,
Vector2Int
originPos
,
Vector2Int
checkPos
)
{
{
int
verticalTile
=
0
,
horizontalTile
=
0
;
int
verticalTile
=
0
,
horizontalTile
=
0
;
...
@@ -75,30 +82,31 @@ public class TileManager : MonoBehaviour
...
@@ -75,30 +82,31 @@ public class TileManager : MonoBehaviour
else
else
return
'b'
;
return
'b'
;
}
}
/// <summary>
/// Check if it is out of the room or not.
/// </summary>
/// <param name="n">Position you want to check.</param>
/// <returns></returns>
bool
IsTileInRoom
(
int
n
)
bool
IsTileInRoom
(
int
n
)
{
{
return
n
>=
0
&&
n
<
24
;
return
n
>=
0
&&
n
<
24
;
}
}
/// <summary>
public
IEnumerator
ChangeAllTiles
(
RoomInGame
roomInGame
)
/// Set all tiles of the room.
/// Cut for every 72 tiles.
/// </summary>
/// <param name="roomInGame">Room you want to set.</param>
/// <returns></returns>
public
IEnumerator
SetAllTiles
(
RoomInGame
roomInGame
)
{
{
int
stage
=
MapManager
.
currentStage
;
int
stage
=
MapManager
.
currentStage
;
//int concept = room.roomConcept;
//int concept = room.roomConcept;
int
concept
=
0
;
int
concept
=
0
;
Tilemap
roomTileMap
=
null
;
Tilemap
roomTileMap
=
MapManager
.
GetChildByName
(
roomInGame
.
transform
,
"wall"
).
GetComponent
<
Tilemap
>();
for
(
int
i
=
0
;
i
<
roomInGame
.
transform
.
childCount
;
i
++)
{
if
(
roomInGame
.
transform
.
GetChild
(
i
).
name
.
Equals
(
"wall"
))
{
roomTileMap
=
roomInGame
.
transform
.
GetChild
(
i
).
GetComponent
<
Tilemap
>();
break
;
}
}
CheckAllTiles
(
roomInGame
);
CheckAllTiles
(
roomInGame
);
for
(
int
y
=
0
;
y
<
24
;
y
++)
for
(
int
y
=
0
;
y
<
24
;
y
++)
{
{
if
(
y
%
2
==
0
)
if
(
y
%
3
==
0
)
yield
return
null
;
yield
return
null
;
for
(
int
x
=
0
;
x
<
24
;
x
++)
for
(
int
x
=
0
;
x
<
24
;
x
++)
{
{
...
@@ -108,20 +116,25 @@ public class TileManager : MonoBehaviour
...
@@ -108,20 +116,25 @@ public class TileManager : MonoBehaviour
CheckQuarterTile
(
roomInGame
,
new
Vector2Int
(
x
,
y
),
new
Vector2Int
(
1
,
1
)).
ToString
()
+
CheckQuarterTile
(
roomInGame
,
new
Vector2Int
(
x
,
y
),
new
Vector2Int
(
1
,
1
)).
ToString
()
+
CheckQuarterTile
(
roomInGame
,
new
Vector2Int
(
x
,
y
),
new
Vector2Int
(-
1
,
-
1
)).
ToString
()
+
CheckQuarterTile
(
roomInGame
,
new
Vector2Int
(
x
,
y
),
new
Vector2Int
(-
1
,
-
1
)).
ToString
()
+
CheckQuarterTile
(
roomInGame
,
new
Vector2Int
(
x
,
y
),
new
Vector2Int
(
1
,
-
1
)).
ToString
();
CheckQuarterTile
(
roomInGame
,
new
Vector2Int
(
x
,
y
),
new
Vector2Int
(
1
,
-
1
)).
ToString
();
Debug
.
Log
(
tileName
);
//Debug.Log(tileName);
roomTileMap
.
SetTile
(
new
Vector3Int
(
x
,
y
,
0
),
tilesDistributed
[
stage
,
concept
][
tileName
]);
if
(
tilesDistributed
[
stage
,
concept
].
ContainsKey
(
tileName
))
roomTileMap
.
SetTile
(
new
Vector3Int
(
x
,
y
,
0
),
tilesDistributed
[
stage
,
concept
][
tileName
]);
}
}
}
}
}
}
yield
return
null
;
yield
return
null
;
}
}
/// <summary>
/// Set tiles for all rooms in tetrimino.
/// </summary>
/// <param name="tetrimino">Tetrimino you want to set.</param>
/// <returns></returns>
public
IEnumerator
SetTetriminoTiles
(
Tetrimino
tetrimino
)
public
IEnumerator
SetTetriminoTiles
(
Tetrimino
tetrimino
)
{
{
for
(
int
i
=
0
;
i
<
tetrimino
.
rooms
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
tetrimino
.
rooms
.
Length
;
i
++)
{
{
yield
return
null
;
yield
return
null
;
StartCoroutine
(
Change
AllTiles
(
tetrimino
.
rooms
[
i
].
roomInGame
));
StartCoroutine
(
Set
AllTiles
(
tetrimino
.
rooms
[
i
].
roomInGame
));
}
}
}
}
}
}
...
...
ProjectSettings/InputManager.asset
View file @
f38d8a10
...
@@ -37,6 +37,38 @@ InputManager:
...
@@ -37,6 +37,38 @@ InputManager:
type
:
0
type
:
0
axis
:
0
axis
:
0
joyNum
:
0
joyNum
:
0
-
serializedVersion
:
3
m_Name
:
TetriminoHorizontal
descriptiveName
:
descriptiveNegativeName
:
negativeButton
:
left
positiveButton
:
right
altNegativeButton
:
altPositiveButton
:
gravity
:
1000
dead
:
0.001
sensitivity
:
1000
snap
:
1
invert
:
0
type
:
0
axis
:
0
joyNum
:
0
-
serializedVersion
:
3
m_Name
:
TetriminoVertical
descriptiveName
:
descriptiveNegativeName
:
negativeButton
:
down
positiveButton
:
up
altNegativeButton
:
altPositiveButton
:
gravity
:
1000
dead
:
0.001
sensitivity
:
1000
snap
:
1
invert
:
0
type
:
0
axis
:
0
joyNum
:
0
-
serializedVersion
:
3
-
serializedVersion
:
3
m_Name
:
Fire1
m_Name
:
Fire1
descriptiveName
:
descriptiveName
:
...
...
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