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
5e806fe3
Commit
5e806fe3
authored
Jan 24, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
포탈 wip
parent
dfcc65bd
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
341 additions
and
19 deletions
+341
-19
Portal.prefab
Assets/Prefabs/Rooms/Portal.prefab
+114
-0
Portal.prefab.meta
Assets/Prefabs/Rooms/Portal.prefab.meta
+8
-0
CameraController.cs
Assets/Scripts/CameraController.cs
+1
-1
Enumerators.cs
Assets/Scripts/Enumerators.cs
+1
-2
GameManager.cs
Assets/Scripts/GameManager.cs
+21
-2
Door.cs
Assets/Scripts/TetrisMap/Door.cs
+1
-11
MapManager.cs
Assets/Scripts/TetrisMap/MapManager.cs
+17
-3
Portal.cs
Assets/Scripts/TetrisMap/Portal.cs
+31
-0
Portal.cs.meta
Assets/Scripts/TetrisMap/Portal.cs.meta
+11
-0
Room.cs
Assets/Scripts/TetrisMap/Room.cs
+28
-0
Portal.png
Assets/Sprites/Rooms/Portal.png
+0
-0
Portal.png.meta
Assets/Sprites/Rooms/Portal.png.meta
+108
-0
No files found.
Assets/Prefabs/Rooms/Portal.prefab
0 → 100644
View file @
5e806fe3
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!1001
&100100000
Prefab
:
m_ObjectHideFlags
:
1
serializedVersion
:
2
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
[]
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
0
}
m_RootGameObject
:
{
fileID
:
1331100254942364
}
m_IsPrefabAsset
:
1
---
!u!1
&1331100254942364
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
4506548288732966
}
-
component
:
{
fileID
:
212212902187430746
}
-
component
:
{
fileID
:
61498167807367822
}
m_Layer
:
0
m_Name
:
Portal
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&4506548288732966
Transform
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1331100254942364
}
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
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!61
&61498167807367822
BoxCollider2D
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1331100254942364
}
m_Enabled
:
1
m_Density
:
1
m_Material
:
{
fileID
:
0
}
m_IsTrigger
:
0
m_UsedByEffector
:
0
m_UsedByComposite
:
0
m_Offset
:
{
x
:
2
,
y
:
2
}
m_SpriteTilingProperty
:
border
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
pivot
:
{
x
:
0
,
y
:
0
}
oldSize
:
{
x
:
4
,
y
:
4
}
newSize
:
{
x
:
4
,
y
:
4
}
adaptiveTilingThreshold
:
0.5
drawMode
:
0
adaptiveTiling
:
0
m_AutoTiling
:
0
serializedVersion
:
2
m_Size
:
{
x
:
4
,
y
:
4
}
m_EdgeRadius
:
0
---
!u!212
&212212902187430746
SpriteRenderer
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1331100254942364
}
m_Enabled
:
1
m_CastShadows
:
0
m_ReceiveShadows
:
0
m_DynamicOccludee
:
1
m_MotionVectors
:
1
m_LightProbeUsage
:
1
m_ReflectionProbeUsage
:
1
m_RenderingLayerMask
:
4294967295
m_Materials
:
-
{
fileID
:
10754
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_StaticBatchInfo
:
firstSubMesh
:
0
subMeshCount
:
0
m_StaticBatchRoot
:
{
fileID
:
0
}
m_ProbeAnchor
:
{
fileID
:
0
}
m_LightProbeVolumeOverride
:
{
fileID
:
0
}
m_ScaleInLightmap
:
1
m_PreserveUVs
:
0
m_IgnoreNormalsForChartDetection
:
0
m_ImportantGI
:
0
m_StitchLightmapSeams
:
0
m_SelectedEditorRenderState
:
0
m_MinimumChartSize
:
4
m_AutoUVMaxDistance
:
0.5
m_AutoUVMaxAngle
:
89
m_LightmapParameters
:
{
fileID
:
0
}
m_SortingLayerID
:
0
m_SortingLayer
:
0
m_SortingOrder
:
0
m_Sprite
:
{
fileID
:
21300000
,
guid
:
6147483bafc37034d91c2afaff57cad1
,
type
:
3
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_FlipX
:
0
m_FlipY
:
0
m_DrawMode
:
0
m_Size
:
{
x
:
4
,
y
:
4
}
m_AdaptiveModeThreshold
:
0.5
m_SpriteTileMode
:
0
m_WasSpriteAssigned
:
1
m_MaskInteraction
:
0
m_SpriteSortPoint
:
0
Assets/Prefabs/Rooms/Portal.prefab.meta
0 → 100644
View file @
5e806fe3
fileFormatVersion: 2
guid: ad5b720a4688efa4b8c3298d87df6f64
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/CameraController.cs
View file @
5e806fe3
...
...
@@ -83,7 +83,7 @@ public class CameraController : MonoBehaviour {
GetComponent
<
Camera
>().
orthographicSize
=
Mathf
.
Lerp
(
GetComponent
<
Camera
>().
orthographicSize
,
sizeDestination
,
Mathf
.
Sqrt
(
Time
.
deltaTime
));
}
}
else
if
(
GameManager
.
gameState
==
GameState
.
Tetris
)
else
if
(
GameManager
.
gameState
==
GameState
.
Tetris
||
GameManager
.
gameState
==
GameState
.
Portal
)
{
StartCoroutine
(
mapManager
.
RoomFadeOut
(
MapManager
.
currentRoom
));
grid
.
transform
.
position
=
new
Vector3
(
0
,
0
,
2
);
...
...
Assets/Scripts/Enumerators.cs
View file @
5e806fe3
...
...
@@ -35,8 +35,7 @@ public enum ComboState {Idle, Combo, Attack}
/// <summary>
/// Enum for game's state.
/// </summary>
public
enum
GameState
{
MainMenu
,
Ingame
,
Tetris
,
Pause
,
Inventory
,
GameOver
}
public
enum
GameState
{
MainMenu
,
Ingame
,
Tetris
,
Portal
,
Inventory
,
Pause
,
GameOver
}
/// <summary>
/// Enum for room types.
/// </summary>
...
...
Assets/Scripts/GameManager.cs
View file @
5e806fe3
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.SceneManagement
;
public
class
GameManager
:
MonoBehaviour
{
...
...
@@ -10,6 +11,15 @@ public class GameManager : MonoBehaviour {
/// </summary>
public
static
GameState
gameState
;
public
Canvas
gameOverScreen
;
public
void
RestartGame
()
{
gameOverScreen
.
gameObject
.
SetActive
(
false
);
SceneManager
.
LoadScene
(
SceneManager
.
GetActiveScene
().
name
);
}
// Use this for initialization
void
Start
()
{
gameState
=
GameState
.
Ingame
;
...
...
@@ -32,8 +42,17 @@ public class GameManager : MonoBehaviour {
}
if
(
gameState
==
GameState
.
GameOver
)
{
if
(
gameOverScreen
.
isActiveAndEnabled
==
false
)
Debug
.
Log
(
"Game Over"
);
Time
.
timeScale
=
0
;
gameOverScreen
.
gameObject
.
SetActive
(
true
);
}
if
(
gameState
==
GameState
.
Portal
)
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
Escape
))
{
gameState
=
GameState
.
Ingame
;
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
());
}
}
}
}
Assets/Scripts/TetrisMap/Door.cs
View file @
5e806fe3
...
...
@@ -51,17 +51,7 @@ public class Door : MonoBehaviour {
break
;
}
MapManager
.
isDoorClosing
=
true
;
MapManager
mapManager
=
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>();
Room
room
=
MapManager
.
currentRoom
;
StartCoroutine
(
mapManager
.
RoomFadeOut
(
room
));
if
(
room
.
specialRoomType
==
RoomType
.
Normal
)
room
.
GetComponent
<
SpriteRenderer
>().
sprite
=
mapManager
.
roomsSpritesDistributed
[
room
.
stage
][(
int
)
RoomSpriteType
.
Normal1
+
room
.
roomConcept
];
else
room
.
GetComponent
<
SpriteRenderer
>().
sprite
=
mapManager
.
roomsSpritesDistributed
[
room
.
stage
][(
int
)
room
.
specialRoomType
];
MapManager
.
currentRoom
=
MapManager
.
tempRoom
;
room
=
MapManager
.
currentRoom
;
StartCoroutine
(
mapManager
.
RoomFadeIn
(
room
));
room
.
GetComponent
<
SpriteRenderer
>().
sprite
=
mapManager
.
roomsSpritesDistributed
[
room
.
stage
][(
int
)
RoomSpriteType
.
Current
];
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
ChangeRoom
();
if
(
MapManager
.
currentRoom
.
isRoomCleared
!=
true
)
{
animatorThisRoom
.
SetBool
(
"isPlayerTouchEnded"
,
true
);
...
...
Assets/Scripts/TetrisMap/MapManager.cs
View file @
5e806fe3
...
...
@@ -152,6 +152,10 @@ public class MapManager : MonoBehaviour {
/// Right door in ingame.
/// </summary>
public
GameObject
inGameDoorRight
;
/// <summary>
/// Portal of a door.
/// </summary>
public
GameObject
Portal
;
public
RoomInGame
[]
normalRoomList1
;
public
RoomInGame
[]
normalRoomList2
;
...
...
@@ -684,9 +688,6 @@ public class MapManager : MonoBehaviour {
room
.
GetComponent
<
SpriteRenderer
>().
sprite
=
roomsSpritesDistributed
[
room
.
stage
][(
int
)
RoomSpriteType
.
Normal1
+
room
.
roomConcept
];
else
room
.
GetComponent
<
SpriteRenderer
>().
sprite
=
roomsSpritesDistributed
[
room
.
stage
][(
int
)
room
.
specialRoomType
];
if
(
currentGhost
!=
null
)
currentGhost
.
rooms
[
i
].
GetComponent
<
SpriteRenderer
>().
sprite
=
room
.
GetComponent
<
SpriteRenderer
>().
sprite
;
}
...
...
@@ -778,6 +779,19 @@ public class MapManager : MonoBehaviour {
yield
return
new
WaitForSeconds
(
1f
);
tetriminoSpawner
.
MakeTetrimino
();
}
public
void
ChangeRoom
()
{
Room
room
=
currentRoom
;
StartCoroutine
(
RoomFadeOut
(
room
));
if
(
room
.
specialRoomType
==
RoomType
.
Normal
)
room
.
GetComponent
<
SpriteRenderer
>().
sprite
=
roomsSpritesDistributed
[
room
.
stage
][(
int
)
RoomSpriteType
.
Normal1
+
room
.
roomConcept
];
else
room
.
GetComponent
<
SpriteRenderer
>().
sprite
=
roomsSpritesDistributed
[
room
.
stage
][(
int
)
room
.
specialRoomType
];
currentRoom
=
tempRoom
;
room
=
currentRoom
;
StartCoroutine
(
RoomFadeIn
(
room
));
room
.
GetComponent
<
SpriteRenderer
>().
sprite
=
roomsSpritesDistributed
[
room
.
stage
][(
int
)
RoomSpriteType
.
Current
];
}
/// <summary>
/// Make room fade in.
/// </summary>
...
...
Assets/Scripts/TetrisMap/Portal.cs
0 → 100644
View file @
5e806fe3
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
Portal
:
MonoBehaviour
{
private
void
OnTriggerStay2D
(
Collider2D
collision
)
{
if
(
collision
.
tag
.
Equals
(
"Player"
))
{
Debug
.
Log
(
"Entered"
);
if
(
Input
.
GetKeyDown
(
KeyCode
.
F
))
{
Debug
.
Log
(
"Portal"
);
GameManager
.
gameState
=
GameState
.
Portal
;
StartCoroutine
(
GameObject
.
FindGameObjectWithTag
(
"MainCamera"
).
GetComponent
<
CameraController
>().
ChangeScene
());
}
}
}
// Use this for initialization
void
Start
()
{
}
// Update is called once per frame
void
Update
()
{
}
}
Assets/Scripts/TetrisMap/Portal.cs.meta
0 → 100644
View file @
5e806fe3
fileFormatVersion: 2
guid: b5ed2c384310eb6408bb42c91b195e15
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/TetrisMap/Room.cs
View file @
5e806fe3
...
...
@@ -77,6 +77,10 @@ public class Room : MonoBehaviour
/// </summary>
public
RoomInGame
roomInGame
;
/// <summary>
/// Portal of the room.
/// </summary>
public
GameObject
portal
;
/// <summary>
/// Check if room is clear and escapable.
/// </summary>
public
bool
isRoomCleared
;
...
...
@@ -130,6 +134,30 @@ public class Room : MonoBehaviour
}
}
}
/// <summary>
/// Create portal in cleared room.
/// </summary>
public
void
CreatePortal
()
{
if
(
specialRoomType
!=
RoomType
.
Normal
)
{
portal
.
SetActive
(
true
);
}
else
{
}
}
/// <summary>
/// Open selected door of this room.
/// </summary>
...
...
Assets/Sprites/Rooms/Portal.png
0 → 100644
View file @
5e806fe3
4.1 KB
Assets/Sprites/Rooms/Portal.png.meta
0 → 100644
View file @
5e806fe3
fileFormatVersion: 2
guid: 6147483bafc37034d91c2afaff57cad1
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 6
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 64
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: ec57d6ddd228a30428caeb240c90f63a
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
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