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
088c7ec6
Commit
088c7ec6
authored
Jan 11, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
페이드 인 및 페이드 아웃 구현 중이고 안개 만듦
parent
58e64dab
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
308 additions
and
58 deletions
+308
-58
MapManager.prefab
Assets/Prefabs/MapManager.prefab
+3
-2
fog.prefab
Assets/Prefabs/TetrisMap/fog.prefab
+88
-0
fog.prefab.meta
Assets/Prefabs/TetrisMap/fog.prefab.meta
+8
-0
CameraController.cs
Assets/Scripts/CameraController.cs
+63
-12
Functions.cs
Assets/Scripts/Functions.cs
+0
-16
GameManager.cs
Assets/Scripts/GameManager.cs
+1
-1
MapManager.cs
Assets/Scripts/TetrisMap/MapManager.cs
+31
-24
Room.cs
Assets/Scripts/TetrisMap/Room.cs
+2
-0
TetriminoSpawner.cs
Assets/Scripts/TetrisMap/TetriminoSpawner.cs
+3
-2
Press.png.meta
Assets/Sprites/Press.png.meta
+1
-1
fog.png
Assets/Sprites/fog.png
+0
-0
fog.png.meta
Assets/Sprites/fog.png.meta
+108
-0
No files found.
Assets/Prefabs/MapManager.prefab
View file @
088c7ec6
...
@@ -64,10 +64,11 @@ MonoBehaviour:
...
@@ -64,10 +64,11 @@ MonoBehaviour:
isTetriminoFalling
:
0
isTetriminoFalling
:
0
spawnBossTetrimino
:
0
spawnBossTetrimino
:
0
press
:
{
fileID
:
114990664041074520
,
guid
:
8e750fd197a05d84c9fb8557eb95c666
,
type
:
2
}
press
:
{
fileID
:
114990664041074520
,
guid
:
8e750fd197a05d84c9fb8557eb95c666
,
type
:
2
}
leftDoor
:
{
fileID
:
1309596820948456
,
guid
:
80ed5bfe62ba3034592296b6e27526bc
,
type
:
2
}
rightDoor
:
{
fileID
:
1614071394812404
,
guid
:
ac9e1e28c8413e54f939bc255268fabd
,
type
:
2
}
currentTetrimino
:
{
fileID
:
0
}
currentTetrimino
:
{
fileID
:
0
}
currentGhost
:
{
fileID
:
0
}
currentGhost
:
{
fileID
:
0
}
fog
:
{
fileID
:
1556853421042486
,
guid
:
b1b68160603303d46a05ec4fa754584c
,
type
:
2
}
leftDoor
:
{
fileID
:
1309596820948456
,
guid
:
80ed5bfe62ba3034592296b6e27526bc
,
type
:
2
}
rightDoor
:
{
fileID
:
1614071394812404
,
guid
:
ac9e1e28c8413e54f939bc255268fabd
,
type
:
2
}
normalRoomList
:
normalRoomList
:
-
{
fileID
:
114452746530220676
,
guid
:
3c35322ac2c308d49aadf20738b69c8b
,
type
:
2
}
-
{
fileID
:
114452746530220676
,
guid
:
3c35322ac2c308d49aadf20738b69c8b
,
type
:
2
}
-
{
fileID
:
114071400998216906
,
guid
:
7fd2833846bb116479bd74d2a5b75487
,
type
:
2
}
-
{
fileID
:
114071400998216906
,
guid
:
7fd2833846bb116479bd74d2a5b75487
,
type
:
2
}
...
...
Assets/Prefabs/TetrisMap/fog.prefab
0 → 100644
View file @
088c7ec6
%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
:
1556853421042486
}
m_IsPrefabAsset
:
1
---
!u!1
&1556853421042486
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
4525536502145364
}
-
component
:
{
fileID
:
212793649797276106
}
m_Layer
:
0
m_Name
:
fog
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&4525536502145364
Transform
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1556853421042486
}
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!212
&212793649797276106
SpriteRenderer
:
m_ObjectHideFlags
:
1
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1556853421042486
}
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
:
0b1a1d7eab61fa947a49ebf55e99a281
,
type
:
3
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_FlipX
:
0
m_FlipY
:
0
m_DrawMode
:
0
m_Size
:
{
x
:
22.499992
,
y
:
22.499992
}
m_AdaptiveModeThreshold
:
0.5
m_SpriteTileMode
:
0
m_WasSpriteAssigned
:
1
m_MaskInteraction
:
0
m_SpriteSortPoint
:
0
Assets/
Scripts/Functions.cs
.meta
→
Assets/
Prefabs/TetrisMap/fog.prefab
.meta
View file @
088c7ec6
fileFormatVersion: 2
fileFormatVersion: 2
guid:
614be83888154ca42a847ded3f4ae655
guid:
b1b68160603303d46a05ec4fa754584c
Mono
Importer:
NativeFormat
Importer:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
mainObjectFileID: 100100000
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
Assets/Scripts/CameraController.cs
View file @
088c7ec6
...
@@ -3,23 +3,32 @@ using System.Collections.Generic;
...
@@ -3,23 +3,32 @@ using System.Collections.Generic;
using
UnityEngine
;
using
UnityEngine
;
public
class
CameraController
:
MonoBehaviour
{
public
class
CameraController
:
MonoBehaviour
{
public
MapManager
mapManager
;
public
LayerMask
roomLayer
;
public
LayerMask
roomLayer
;
public
GameObject
player
;
public
GameObject
player
;
/// <summary>
/// Coroutine controls scene changing.
/// </summary>
public
Coroutine
sceneChanger
;
/*
/*
* If camera is in Tetris view, ideal position is (108, 240, -1)
* If camera is in Tetris view, ideal position is (108, 240, -1)
* size 300
* size 300
* */
* */
readonly
float
camX
=
9.5f
;
readonly
float
camX
=
9.5f
;
readonly
float
camY
=
4f
;
readonly
float
camY
=
4f
;
p
rivate
Vector3
tetrisCameraCoord
=
new
Vector3
(
108
,
240
,
-
1
);
p
ublic
Vector3
tetrisCameraCoord
=
new
Vector3
(
108
,
240
,
-
1
);
p
rivate
float
tetrisCameraSize
=
300f
;
p
ublic
const
float
tetrisCameraSize
=
300f
;
p
rivate
float
inGameCameraSize
=
4.5f
;
p
ublic
const
float
inGameCameraSize
=
4.5f
;
GameManager
.
GameState
lastGameState
;
GameManager
.
GameState
lastGameState
;
Vector3
destination
;
Vector3
destination
;
private
void
Awake
()
{
mapManager
=
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>();
}
// Use this for initialization
// Use this for initialization
void
Start
()
void
Start
()
...
@@ -45,12 +54,34 @@ public class CameraController : MonoBehaviour {
...
@@ -45,12 +54,34 @@ public class CameraController : MonoBehaviour {
}
}
IEnumerator
ChangeScene
()
IEnumerator
ChangeScene
(
Vector3
cameraDestination
,
float
cameraSize
,
GameManager
.
GameState
_gameState
)
{
{
GameObject
grid
=
GameObject
.
Find
(
"Grid"
);
float
alpha
=
1
;
yield
return
null
;
if
(
GameManager
.
gameState
==
GameManager
.
GameState
.
Ingame
)
{
mapManager
.
currentRoom
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
0
);
grid
.
transform
.
position
=
new
Vector3
(
0
,
0
,
0
);
}
else
if
(
GameManager
.
gameState
==
GameManager
.
GameState
.
Tetris
)
{
grid
.
transform
.
position
=
new
Vector3
(
0
,
0
,
2
);
}
while
((
_gameState
==
GameManager
.
GameState
.
Tetris
&&
GetComponent
<
Camera
>().
orthographicSize
<
cameraSize
-
1
)
||
(
_gameState
==
GameManager
.
GameState
.
Ingame
&&
GetComponent
<
Camera
>().
orthographicSize
>
cameraSize
+
0.1
))
{
yield
return
new
WaitForSeconds
(
0.01f
);
Vector2
coord
=
Vector2
.
Lerp
(
transform
.
position
,
cameraDestination
,
Mathf
.
Sqrt
(
Time
.
deltaTime
));
transform
.
position
=
new
Vector3
(
coord
.
x
,
coord
.
y
,
-
1
);
GetComponent
<
Camera
>().
orthographicSize
=
Mathf
.
Lerp
(
GetComponent
<
Camera
>().
orthographicSize
,
cameraSize
,
Mathf
.
Sqrt
(
Time
.
deltaTime
));
if
(
_gameState
==
GameManager
.
GameState
.
Ingame
)
alpha
=
Mathf
.
Lerp
(
alpha
,
0
,
Mathf
.
Sqrt
(
Time
.
deltaTime
));
else
if
(
_gameState
==
GameManager
.
GameState
.
Tetris
)
alpha
=
1
;
mapManager
.
currentRoom
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
alpha
);
}
transform
.
position
=
cameraDestination
;
GetComponent
<
Camera
>().
orthographicSize
=
cameraSize
;
MapManager
.
originPos
=
transform
.
position
;
}
}
void
SetDestination
()
void
SetDestination
()
{
{
...
@@ -155,22 +186,42 @@ public class CameraController : MonoBehaviour {
...
@@ -155,22 +186,42 @@ public class CameraController : MonoBehaviour {
return
-
1
;
return
-
1
;
}
}
public
void
ChangeState
()
public
void
ChangeState
()
{
{
GameObject
grid
=
GameObject
.
Find
(
"Grid"
);
GameObject
grid
=
GameObject
.
Find
(
"Grid"
);
if
(
Input
.
GetKeyDown
(
KeyCode
.
Tab
)
&&
GameManager
.
gameState
==
GameManager
.
GameState
.
Ingame
)
if
(
Input
.
GetKeyDown
(
KeyCode
.
Tab
)
&&
GameManager
.
gameState
==
GameManager
.
GameState
.
Ingame
)
{
{
GameManager
.
gameState
=
GameManager
.
GameState
.
Tetris
;
GameManager
.
gameState
=
GameManager
.
GameState
.
Tetris
;
transform
.
position
=
tetrisCameraCoord
;
if
(
sceneChanger
!=
null
)
StopCoroutine
(
sceneChanger
);
sceneChanger
=
StartCoroutine
(
ChangeScene
(
tetrisCameraCoord
,
tetrisCameraSize
,
GameManager
.
gameState
));
/*transform.position = tetrisCameraCoord;
GetComponent<Camera>().orthographicSize = tetrisCameraSize;
GetComponent<Camera>().orthographicSize = tetrisCameraSize;
//grid.transform.position = new Vector3(0, 0, 2);
grid.transform.position = new Vector3(0, 0, 2);
MapManager.originPos = transform.position;*/
}
}
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Tab
)
&&
GameManager
.
gameState
==
GameManager
.
GameState
.
Tetris
)
else
if
(
Input
.
GetKeyDown
(
KeyCode
.
Tab
)
&&
GameManager
.
gameState
==
GameManager
.
GameState
.
Tetris
)
{
{
GameManager
.
gameState
=
GameManager
.
GameState
.
Ingame
;
GameManager
.
gameState
=
GameManager
.
GameState
.
Ingame
;
GetComponent
<
Camera
>().
orthographicSize
=
inGameCameraSize
;
//grid.transform.position = new Vector3(0, 0, 0);
if
(
sceneChanger
!=
null
)
StopCoroutine
(
sceneChanger
);
sceneChanger
=
StartCoroutine
(
ChangeScene
(
player
.
transform
.
position
,
inGameCameraSize
,
GameManager
.
gameState
));
/*GetComponent<Camera>().orthographicSize = inGameCameraSize;
grid.transform.position = new Vector3(0, 0, 0);
transform.position = player.transform.position;
GotoDestination();
GotoDestination();
MapManager.originPos = transform.position;*/
}
}
}
}
}
}
\ No newline at end of file
Assets/Scripts/Functions.cs
deleted
100644 → 0
View file @
58e64dab
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
Functions
:
MonoBehaviour
{
// Use this for initialization
void
Start
()
{
}
// Update is called once per frame
void
Update
()
{
}
}
Assets/Scripts/GameManager.cs
View file @
088c7ec6
...
@@ -17,7 +17,7 @@ public class GameManager : MonoBehaviour {
...
@@ -17,7 +17,7 @@ public class GameManager : MonoBehaviour {
var
TS
=
GameObject
.
Find
(
"TetriminoSpawner"
).
GetComponent
<
TetriminoSpawner
>();
var
TS
=
GameObject
.
Find
(
"TetriminoSpawner"
).
GetComponent
<
TetriminoSpawner
>();
gameState
=
GameState
.
Ingame
;
gameState
=
GameState
.
Ingame
;
TS
.
MakeInitialTetrimino
();
TS
.
MakeInitialTetrimino
();
Vector2
coord
=
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
star
tRoom
.
transform
.
position
;
Vector2
coord
=
GameObject
.
Find
(
"MapManager"
).
GetComponent
<
MapManager
>().
curren
tRoom
.
transform
.
position
;
GameObject
.
Find
(
"Player"
).
transform
.
position
=
new
Vector2
(
coord
.
x
,
coord
.
y
)
+
new
Vector2
(
3
,
3
);
GameObject
.
Find
(
"Player"
).
transform
.
position
=
new
Vector2
(
coord
.
x
,
coord
.
y
)
+
new
Vector2
(
3
,
3
);
...
...
Assets/Scripts/TetrisMap/MapManager.cs
View file @
088c7ec6
...
@@ -88,14 +88,6 @@ public class MapManager : MonoBehaviour {
...
@@ -88,14 +88,6 @@ public class MapManager : MonoBehaviour {
/// </summary>
/// </summary>
public
Press
press
;
public
Press
press
;
/// <summary>
/// <summary>
/// Left door.
/// </summary>
public
GameObject
leftDoor
;
/// <summary>
/// Right door.
/// </summary>
public
GameObject
rightDoor
;
/// <summary>
/// Current tetrimino waiting for falling.
/// Current tetrimino waiting for falling.
/// </summary>
/// </summary>
public
Tetrimino
currentTetrimino
;
public
Tetrimino
currentTetrimino
;
...
@@ -108,6 +100,18 @@ public class MapManager : MonoBehaviour {
...
@@ -108,6 +100,18 @@ public class MapManager : MonoBehaviour {
/// </summary>
/// </summary>
public
enum
SpecialRoomType
{
Start
,
Item
,
BothSide
,
Gold
,
Amethyst
,
Boss
,
Normal
};
public
enum
SpecialRoomType
{
Start
,
Item
,
BothSide
,
Gold
,
Amethyst
,
Boss
,
Normal
};
/// <summary>
/// <summary>
/// Fog of rooms.
/// </summary>
public
GameObject
fog
;
/// <summary>
/// Left door.
/// </summary>
public
GameObject
leftDoor
;
/// <summary>
/// Right door.
/// </summary>
public
GameObject
rightDoor
;
/// <summary>
/// Array for the normal Room candidates.
/// Array for the normal Room candidates.
/// </summary>
/// </summary>
public
RoomInGame
[]
normalRoomList
;
public
RoomInGame
[]
normalRoomList
;
...
@@ -120,9 +124,9 @@ public class MapManager : MonoBehaviour {
...
@@ -120,9 +124,9 @@ public class MapManager : MonoBehaviour {
/// </summary>
/// </summary>
List
<
RoomInGame
>[,]
normalRoomsDistributed
=
new
List
<
RoomInGame
>[
3
,
3
];
List
<
RoomInGame
>[,]
normalRoomsDistributed
=
new
List
<
RoomInGame
>[
3
,
3
];
/// <summary>
/// <summary>
///
First r
oom player exists.
///
R
oom player exists.
/// </summary>
/// </summary>
public
Room
star
tRoom
;
public
Room
curren
tRoom
;
/// <summary>
/// <summary>
/// Queue that saves rooms waiting for upgrade tetrimino.
/// Queue that saves rooms waiting for upgrade tetrimino.
/// </summary>
/// </summary>
...
@@ -350,8 +354,8 @@ public class MapManager : MonoBehaviour {
...
@@ -350,8 +354,8 @@ public class MapManager : MonoBehaviour {
}
}
if
(
shakeCamera
)
if
(
shakeCamera
)
{
{
GameObject
camera
=
GameObject
.
Find
(
"Tetris Camera"
);
Camera
camera
=
FindObjectOfType
<
Camera
>(
);
StartCoroutine
(
CameraShake
(
5
*
(
top
-
bottom
+
1
),
camera
.
transform
.
position
,
camera
));
StartCoroutine
(
CameraShake
(
5
*
(
top
-
bottom
+
1
)
/
CameraController
.
tetrisCameraSize
,
camera
.
transform
.
position
,
camera
));
}
}
for
(
int
i
=
0
;
i
<
height
;
i
++)
for
(
int
i
=
0
;
i
<
height
;
i
++)
{
{
...
@@ -543,8 +547,8 @@ public class MapManager : MonoBehaviour {
...
@@ -543,8 +547,8 @@ public class MapManager : MonoBehaviour {
fallSpeed
+=
gravity
*
fallTime
*
fallTime
;
fallSpeed
+=
gravity
*
fallTime
*
fallTime
;
te
.
transform
.
position
+=
new
Vector3
(
0
,
-
fallSpeed
,
0
);
te
.
transform
.
position
+=
new
Vector3
(
0
,
-
fallSpeed
,
0
);
}
}
GameObject
camera
=
GameObject
.
Find
(
"Main Camera"
);
Camera
camera
=
FindObjectOfType
<
Camera
>(
);
StartCoroutine
(
CameraShake
(
20
,
camera
.
transform
.
position
,
camera
));
StartCoroutine
(
CameraShake
(
20
/
CameraController
.
tetrisCameraSize
,
camera
.
transform
.
position
,
camera
));
EndTetrimino
(
te
);
EndTetrimino
(
te
);
}
}
/// <summary>
/// <summary>
...
@@ -622,21 +626,23 @@ public class MapManager : MonoBehaviour {
...
@@ -622,21 +626,23 @@ public class MapManager : MonoBehaviour {
{
{
for
(
int
i
=
0
;
i
<
te
.
rooms
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
te
.
rooms
.
Length
;
i
++)
{
{
te
.
rooms
[
i
].
transform
.
position
+=
new
Vector3
(
0
,
0
,
-
2
);
te
.
rooms
[
i
].
transform
.
parent
=
grid
;
if
(
GameManager
.
gameState
==
GameManager
.
GameState
.
Ingame
)
te
.
rooms
[
i
].
transform
.
localPosition
+=
new
Vector3
(
0
,
0
,
-
2
);
te
.
rooms
[
i
].
SetDoors
();
te
.
rooms
[
i
].
SetDoors
();
if
(
te
.
rooms
[
i
].
specialRoomType
!=
SpecialRoomType
.
Normal
)
if
(
te
.
rooms
[
i
].
specialRoomType
!=
SpecialRoomType
.
Normal
)
{
{
Instantiate
(
specialRoomList
[(
int
)
te
.
rooms
[
i
].
specialRoomType
],
te
.
rooms
[
i
].
transform
.
position
+
new
Vector3
(
0
,
0
,
2
),
Quaternion
.
identity
,
te
.
rooms
[
i
].
transform
);
te
.
rooms
[
i
].
roomInGame
=
Instantiate
(
specialRoomList
[(
int
)
te
.
rooms
[
i
].
specialRoomType
],
te
.
rooms
[
i
].
transform
.
position
+
new
Vector3
(
0
,
0
,
2
),
Quaternion
.
identity
,
te
.
rooms
[
i
].
transform
);
}
}
else
else
{
{
int
left
=
te
.
rooms
[
i
].
leftDoorLocation
;
int
left
=
te
.
rooms
[
i
].
leftDoorLocation
;
int
right
=
te
.
rooms
[
i
].
rightDoorLocation
;
int
right
=
te
.
rooms
[
i
].
rightDoorLocation
;
Instantiate
(
normalRoomsDistributed
[
left
,
right
][
Random
.
Range
(
0
,
normalRoomsDistributed
[
left
,
right
].
Count
)],
te
.
rooms
[
i
].
transform
.
position
+
new
Vector3
(
0
,
0
,
2
),
te
.
rooms
[
i
].
roomInGame
=
Instantiate
(
normalRoomsDistributed
[
left
,
right
][
Random
.
Range
(
0
,
normalRoomsDistributed
[
left
,
right
].
Count
)],
te
.
rooms
[
i
].
transform
.
position
+
new
Vector3
(
0
,
0
,
2
),
Quaternion
.
identity
,
te
.
rooms
[
i
].
transform
);
Quaternion
.
identity
,
te
.
rooms
[
i
].
transform
);
}
}
te
.
rooms
[
i
].
CreateDoors
(
leftDoor
,
rightDoor
);
te
.
rooms
[
i
].
CreateDoors
(
leftDoor
,
rightDoor
);
te
.
rooms
[
i
].
transform
.
parent
=
grid
;
te
.
rooms
[
i
].
fog
=
Instantiate
(
fog
,
te
.
rooms
[
i
].
transform
.
position
+
new
Vector3
(
12
,
12
,
2
),
Quaternion
.
identity
,
te
.
rooms
[
i
].
transform
)
;
}
}
Destroy
(
te
.
gameObject
);
Destroy
(
te
.
gameObject
);
}
}
...
@@ -692,6 +698,8 @@ public class MapManager : MonoBehaviour {
...
@@ -692,6 +698,8 @@ public class MapManager : MonoBehaviour {
yield
return
new
WaitForSeconds
(
1f
);
yield
return
new
WaitForSeconds
(
1f
);
tetriminoSpawner
.
MakeTetrimino
();
tetriminoSpawner
.
MakeTetrimino
();
}
}
public
static
Vector3
originPos
;
/// <summary>
/// <summary>
/// Shake the camera when tetrimino has fallen.
/// Shake the camera when tetrimino has fallen.
/// </summary>
/// </summary>
...
@@ -699,15 +707,15 @@ public class MapManager : MonoBehaviour {
...
@@ -699,15 +707,15 @@ public class MapManager : MonoBehaviour {
/// <param name="originPos">Original position of the camera.</param>
/// <param name="originPos">Original position of the camera.</param>
/// <param name="camera">Camera you want to shake.</param>
/// <param name="camera">Camera you want to shake.</param>
/// <returns></returns>
/// <returns></returns>
public
IEnumerator
CameraShake
(
float
_amount
,
Vector3
originPos
,
GameObject
camera
)
public
IEnumerator
CameraShake
(
float
_amount
,
Vector3
_originPos
,
Camera
camera
)
{
{
float
amount
=
_amount
;
float
amount
=
_amount
;
Vector3
cameraPos
=
_originPos
;
originPos
=
_originPos
;
while
(
amount
>
0
)
while
(
amount
>
0
)
{
{
//transform.localPosition = (Vector3)Random.insideUnitCircle * amount + originPos;
cameraPos
=
new
Vector3
(
0.2f
*
Random
.
insideUnitCircle
.
x
*
amount
*
camera
.
orthographicSize
+
originPos
.
x
,
Random
.
insideUnitCircle
.
y
*
amount
*
camera
.
orthographicSize
+
originPos
.
y
,
originPos
.
z
);
camera
.
transform
.
localPosition
=
new
Vector3
(
0.2f
*
Random
.
insideUnitCircle
.
x
*
amount
+
originPos
.
x
,
Random
.
insideUnitCircle
.
y
*
amount
+
originPos
.
y
,
originPos
.
z
);
camera
.
transform
.
position
=
cameraPos
;
//transform.localPosition = new Vector3(Random.insideUnitCircle.x * amount + originPos.x, originPos.y, originPos.z);
//transform.localPosition = new Vector3(originPos.x, Random.insideUnitCircle.y * amount + originPos.y, originPos.z);
amount
-=
_amount
/
40
;
amount
-=
_amount
/
40
;
yield
return
null
;
yield
return
null
;
}
}
...
@@ -748,7 +756,6 @@ public class MapManager : MonoBehaviour {
...
@@ -748,7 +756,6 @@ public class MapManager : MonoBehaviour {
rightCount
=
0
;
rightCount
=
0
;
leftCount
++;
leftCount
++;
}
}
}
}
tetriminoSpawner
=
GameObject
.
Find
(
"TetriminoSpawner"
).
GetComponent
<
TetriminoSpawner
>();
tetriminoSpawner
=
GameObject
.
Find
(
"TetriminoSpawner"
).
GetComponent
<
TetriminoSpawner
>();
}
}
...
...
Assets/Scripts/TetrisMap/Room.cs
View file @
088c7ec6
...
@@ -32,6 +32,8 @@ public class Room : MonoBehaviour
...
@@ -32,6 +32,8 @@ public class Room : MonoBehaviour
public
MapManager
.
SpecialRoomType
specialRoomType
;
public
MapManager
.
SpecialRoomType
specialRoomType
;
public
int
leftDoorLocation
;
public
int
leftDoorLocation
;
public
int
rightDoorLocation
;
public
int
rightDoorLocation
;
public
GameObject
fog
;
public
RoomInGame
roomInGame
;
/// <summary>
/// <summary>
/// Select which doors would be opened.
/// Select which doors would be opened.
/// </summary>
/// </summary>
...
...
Assets/Scripts/TetrisMap/TetriminoSpawner.cs
View file @
088c7ec6
...
@@ -72,8 +72,8 @@ public class TetriminoSpawner : MonoBehaviour {
...
@@ -72,8 +72,8 @@ public class TetriminoSpawner : MonoBehaviour {
int
randomPosition
=
Random
.
Range
(
0
,
MapManager
.
width
);
int
randomPosition
=
Random
.
Range
(
0
,
MapManager
.
width
);
int
randomTetrimino
=
TetriminoRandomizer
();
int
randomTetrimino
=
TetriminoRandomizer
();
mapManager
.
currentTetrimino
=
Instantiate
(
tetriminoes
[
randomTetrimino
],
mapManager
.
tetrisMapCoord
+
mapManager
.
tetrisMapSize
*
new
Vector3
(
randomPosition
,
0
,
mapManager
.
tetrisMapCoord
.
z
),
Quaternion
.
identity
);
mapManager
.
currentTetrimino
=
Instantiate
(
tetriminoes
[
randomTetrimino
],
mapManager
.
tetrisMapCoord
+
mapManager
.
tetrisMapSize
*
new
Vector3
(
randomPosition
,
0
,
mapManager
.
tetrisMapCoord
.
z
),
Quaternion
.
identity
);
mapManager
.
star
tRoom
=
mapManager
.
currentTetrimino
.
rooms
[
Random
.
Range
(
0
,
mapManager
.
currentTetrimino
.
rooms
.
Length
)];
mapManager
.
curren
tRoom
=
mapManager
.
currentTetrimino
.
rooms
[
Random
.
Range
(
0
,
mapManager
.
currentTetrimino
.
rooms
.
Length
)];
mapManager
.
star
tRoom
.
specialRoomType
=
MapManager
.
SpecialRoomType
.
Start
;
mapManager
.
curren
tRoom
.
specialRoomType
=
MapManager
.
SpecialRoomType
.
Start
;
mapManager
.
currentTetrimino
.
mapCoord
=
(
mapManager
.
currentTetrimino
.
transform
.
position
-
mapManager
.
tetrisMapCoord
)
/
mapManager
.
tetrisMapSize
;
mapManager
.
currentTetrimino
.
mapCoord
=
(
mapManager
.
currentTetrimino
.
transform
.
position
-
mapManager
.
tetrisMapCoord
)
/
mapManager
.
tetrisMapSize
;
mapManager
.
SetRoomMapCoord
(
mapManager
.
currentTetrimino
);
mapManager
.
SetRoomMapCoord
(
mapManager
.
currentTetrimino
);
mapManager
.
MakeTetriminoRightPlace
(
mapManager
.
currentTetrimino
);
mapManager
.
MakeTetriminoRightPlace
(
mapManager
.
currentTetrimino
);
...
@@ -83,6 +83,7 @@ public class TetriminoSpawner : MonoBehaviour {
...
@@ -83,6 +83,7 @@ public class TetriminoSpawner : MonoBehaviour {
}
}
mapManager
.
UpdateMap
(
mapManager
.
currentTetrimino
);
mapManager
.
UpdateMap
(
mapManager
.
currentTetrimino
);
mapManager
.
CreateRoom
(
mapManager
.
currentTetrimino
);
mapManager
.
CreateRoom
(
mapManager
.
currentTetrimino
);
mapManager
.
currentRoom
.
fog
.
GetComponent
<
SpriteRenderer
>().
color
=
new
Color
(
1
,
1
,
1
,
0
);
MakeTetrimino
();
MakeTetrimino
();
}
}
}
}
...
...
Assets/Sprites/Press.png.meta
View file @
088c7ec6
...
@@ -31,7 +31,7 @@ TextureImporter:
...
@@ -31,7 +31,7 @@ TextureImporter:
maxTextureSize: 2048
maxTextureSize: 2048
textureSettings:
textureSettings:
serializedVersion: 2
serializedVersion: 2
filterMode:
-1
filterMode:
0
aniso: -1
aniso: -1
mipBias: -100
mipBias: -100
wrapU: 1
wrapU: 1
...
...
Assets/Sprites/fog.png
0 → 100644
View file @
088c7ec6
829 Bytes
Assets/Sprites/fog.png.meta
0 → 100644
View file @
088c7ec6
fileFormatVersion: 2
guid: 0b1a1d7eab61fa947a49ebf55e99a281
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: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 10.66667
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: f2adc9928a6a3644b8e4f3591bd70f4f
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