Commit 7a20aadd authored by 18손재민's avatar 18손재민

벽 제작 중

parent 0cfe6b05
...@@ -54,25 +54,44 @@ MonoBehaviour: ...@@ -54,25 +54,44 @@ MonoBehaviour:
grid: {fileID: 0} grid: {fileID: 0}
tetrisMapSize: 24 tetrisMapSize: 24
tetrisMapCoord: {x: 0, y: 0, z: 0} tetrisMapCoord: {x: 0, y: 0, z: 0}
fallSpeed: -0.1
initialFallSpeed: -0.1 initialFallSpeed: -0.1
gravity: 0.98 gravity: 0.98
collapseTime: 0 collapseTime: 1
fallTime: 0
gameOver: 0 gameOver: 0
isTetriminoFalling: 0 isTetriminoFalling: 0
spawnBossTetrimino: 0 spawnBossTetrimino: 0
tetrisMap: {fileID: 0} tetrisMap: {fileID: 1320366940629302, guid: 668207ef06c134e40b24375977c2c930, type: 2}
tetrisPress: {fileID: 1842283105111692, guid: 8e750fd197a05d84c9fb8557eb95c666,
type: 2}
currentTetrimino: {fileID: 0} currentTetrimino: {fileID: 0}
currentGhost: {fileID: 0} currentGhost: {fileID: 0}
normalRoomList: normalRoomList:
- {fileID: 114608209787691684, guid: 702a2175c3762fd4b9bc1fac0357a1a0, type: 2} - {fileID: 114867965473581566, guid: 3c35322ac2c308d49aadf20738b69c8b, type: 2}
- {fileID: 114492511082352868, guid: ab849dd6d89e7254f83aac30e7b19a30, type: 2}
- {fileID: 114559990482232978, guid: 8a277fab4c930814a89f83d11e915f3b, type: 2}
- {fileID: 114408584516131240, guid: 5712fafd2b645fe488586143d15320c3, type: 2}
- {fileID: 114595926560157356, guid: e755ae028f96c11478d088a2fbc15284, type: 2}
- {fileID: 114782876047334178, guid: b2aea3753aeb72e48877392a65019c75, type: 2}
- {fileID: 114470026489049436, guid: 1b7e15c651b43934ba83bf5af546dac8, type: 2}
- {fileID: 114863265537427244, guid: bcdfbba992e4b5c40a05376093119de1, type: 2}
- {fileID: 114949247335388822, guid: 342cab59f70a5b342a805799c5ae6207, type: 2}
- {fileID: 114484571057831710, guid: 1c41b406c1de80c4e93930331d2fa697, type: 2}
- {fileID: 114743815453509364, guid: f0254b56972e32745aef8a6fd6e5f500, type: 2}
- {fileID: 114788150064050122, guid: 6ed897f0c1013fc4883f7bf0db7b4e1a, type: 2}
- {fileID: 114377614119600362, guid: a3477b8af02171c478e610b1347cfa30, type: 2}
- {fileID: 114471976571779658, guid: a02cf80bd4dc5bf4eb59b598c282b924, type: 2}
- {fileID: 114416208672800444, guid: bc907848815150142844bfc2c5587c9f, type: 2}
- {fileID: 114966549601019394, guid: 0c232948c60d71447838601bcd333755, type: 2}
- {fileID: 114151492124372836, guid: c77255b74b15422448c3752f223cf177, type: 2}
- {fileID: 114869574872569484, guid: 478354a3449548a44ba40d516d1cc3cd, type: 2}
- {fileID: 114518681048152984, guid: 5d9d617a37ddce4448c92cca0946ab18, type: 2}
- {fileID: 114849596069850384, guid: bfa57985877d23b46929238f077b40df, type: 2}
specialRoomList: specialRoomList:
- {fileID: 114495009210863316, guid: 4b147f1162668f44aa55982681399aec, type: 2} - {fileID: 114422406439171286, guid: 8fddb267ac5bdf84b9def0dab7ff2071, type: 2}
- {fileID: 114206258087780418, guid: 00a3cc75c0f86a5429975c059b71c269, type: 2} - {fileID: 114206258087780418, guid: 00a3cc75c0f86a5429975c059b71c269, type: 2}
- {fileID: 114589998919791384, guid: fe17cba28f910e54faf7b866f86bfd3e, type: 2} - {fileID: 114589998919791384, guid: fe17cba28f910e54faf7b866f86bfd3e, type: 2}
- {fileID: 114834209009617488, guid: f6834170b7152ee4db0dc7e165dcca70, type: 2} - {fileID: 114834209009617488, guid: f6834170b7152ee4db0dc7e165dcca70, type: 2}
- {fileID: 114310635400106216, guid: 7da800d1a4355fd4aa02e3518cd9e1fb, type: 2} - {fileID: 114748839344937290, guid: 7da800d1a4355fd4aa02e3518cd9e1fb, type: 2}
- {fileID: 114076836714455396, guid: 1ec0004bbafe6764d9462251b866e6e6, type: 2} - {fileID: 114177111557011372, guid: 2514de8c1d17b734592b5fe2cdc74560, type: 2}
controlCurrentTetrimino: 0 controlCurrentTetrimino: 0
startRoom: {fileID: 0} startRoom: {fileID: 0}
...@@ -9,17 +9,18 @@ Prefab: ...@@ -9,17 +9,18 @@ Prefab:
m_Modifications: [] m_Modifications: []
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 0} m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1642234478170196} m_RootGameObject: {fileID: 1842283105111692}
m_IsPrefabAsset: 1 m_IsPrefabAsset: 1
--- !u!1 &1642234478170196 --- !u!1 &1842283105111692
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 4222339323903414} - component: {fileID: 4390237108358754}
- component: {fileID: 114981155842112620} - component: {fileID: 212490318858521944}
- component: {fileID: 114990664041074520}
m_Layer: 0 m_Layer: 0
m_Name: Press m_Name: Press
m_TagString: Untagged m_TagString: Untagged
...@@ -27,12 +28,12 @@ GameObject: ...@@ -27,12 +28,12 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!4 &4222339323903414 --- !u!4 &4390237108358754
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1642234478170196} m_GameObject: {fileID: 1842283105111692}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
...@@ -40,14 +41,60 @@ Transform: ...@@ -40,14 +41,60 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114981155842112620 --- !u!114 &114990664041074520
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1642234478170196} m_GameObject: {fileID: 1842283105111692}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8de047d1ea5a84a4b90377ec18a40ccd, type: 3} m_Script: {fileID: 11500000, guid: 8de047d1ea5a84a4b90377ec18a40ccd, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!212 &212490318858521944
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1842283105111692}
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: 1
m_Sprite: {fileID: 21300000, guid: c6beb369e5ae4e54c9be6a3318849ca0, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.64, y: 2.56}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
...@@ -9,6 +9,9 @@ public class MapManager : MonoBehaviour { ...@@ -9,6 +9,9 @@ public class MapManager : MonoBehaviour {
* */ * */
TetriminoSpawner TS; TetriminoSpawner TS;
/// <summary>
/// Grid showing tiles.
/// </summary>
public Transform grid; public Transform grid;
/// <summary> /// <summary>
/// Tetris map's size. /// Tetris map's size.
...@@ -21,15 +24,31 @@ public class MapManager : MonoBehaviour { ...@@ -21,15 +24,31 @@ public class MapManager : MonoBehaviour {
/// <summary> /// <summary>
/// Tetrimino falling speed. /// Tetrimino falling speed.
/// </summary> /// </summary>
public float fallSpeed = -0.1f; private float fallSpeed = -0.1f;
/// <summary>
/// Tetrimino's initial falling speed.
/// </summary>
public float initialFallSpeed = -0.1f; public float initialFallSpeed = -0.1f;
/// <summary> /// <summary>
/// Tetrimino falling gravity. /// Tetrimino falling gravity.
/// </summary> /// </summary>
public float gravity = 0.98f; public float gravity = 0.98f;
/// <summary>
/// Time Tetrimino has fallen.
/// </summary>
private float fallTime;
/// <summary>
/// Time tetrimino has started to fall.
/// </summary>
private float initialFallTime;
/// <summary>
/// The time taken for a press to be collapsed.
/// </summary>
public float collapseTime; public float collapseTime;
public float fallTime; /// <summary>
float initialFallTime; /// Time press has started to collapsed.
/// </summary>
private float initialCollapseTime;
public static int height = 24, width = 10, realHeight = height - 5; public static int height = 24, width = 10, realHeight = height - 5;
...@@ -40,12 +59,16 @@ public class MapManager : MonoBehaviour { ...@@ -40,12 +59,16 @@ public class MapManager : MonoBehaviour {
/// <summary> /// <summary>
/// Current state of game. /// Current state of game.
/// </summary> /// </summary>
public bool gameOver = false; public bool gameOver;
/// <summary> /// <summary>
/// Check if tetrimino is falling. /// Check if tetrimino is falling.
/// </summary> /// </summary>
public bool isTetriminoFalling = false; public bool isTetriminoFalling = false;
/// <summary> /// <summary>
/// Check if this row is being deleted.
/// </summary>
public bool[] isRowDeleting = new bool[20];
/// <summary>
/// Tetris Y axis coordinates on Unity. /// Tetris Y axis coordinates on Unity.
/// </summary> /// </summary>
public static float[] tetrisYCoord = new float[height]; public static float[] tetrisYCoord = new float[height];
...@@ -58,6 +81,10 @@ public class MapManager : MonoBehaviour { ...@@ -58,6 +81,10 @@ public class MapManager : MonoBehaviour {
/// </summary> /// </summary>
public GameObject tetrisMap; public GameObject tetrisMap;
/// <summary> /// <summary>
/// Presses one row.
/// </summary>
public GameObject tetrisPress;
/// <summary>
/// Current tetrimino waiting for falling. /// Current tetrimino waiting for falling.
/// </summary> /// </summary>
public Tetrimino currentTetrimino; public Tetrimino currentTetrimino;
...@@ -152,32 +179,49 @@ public class MapManager : MonoBehaviour { ...@@ -152,32 +179,49 @@ public class MapManager : MonoBehaviour {
} }
} }
/// <summary> /// <summary>
/// Delete one row. /// Find and delete full rows.
/// </summary> /// </summary>
/// <param name="row">Rows wanted to be deleted.</param>
public void DeleteRow(int row)
{
for (int x = 0; x < width; x++)
{
Destroy(mapGrid[x, row].gameObject);
mapGrid[x, row] = null;
}
}
public void DeleteFullRows() public void DeleteFullRows()
{ {
for(int y = realHeight; y >= 0; y--) for(int y = realHeight; y >= 0; y--)
{ {
if (IsRowFull(y)) if (IsRowFull(y) && !isRowDeleting[y])
{ {
for (int x = 0; x < width; x++) isRowDeleting[y] = true;
initialCollapseTime = Time.time;
GameObject leftPress = Instantiate(tetrisPress, new Vector3(0, y * 24, 0), Quaternion.identity);
leftPress.GetComponent<Press>().isLeft = true;
GameObject rightPress = Instantiate(tetrisPress, new Vector3(240, y * 24, 0), Quaternion.identity);
rightPress.GetComponent<Press>().isLeft = false;
StartCoroutine(TetrisPress(y, leftPress, rightPress));
/*for (int x = 0; x < width; x++)
{ {
Destroy(mapGrid[x, y].gameObject); Destroy(mapGrid[x, y].gameObject);
mapGrid[x, y] = null; mapGrid[x, y] = null;
} }
DecreaseRowsAbove(y); DecreaseRowsAbove(y);*/
} }
} }
} }
public IEnumerator TetrisPress(int row, GameObject leftPress, GameObject rightPress)
{
while (Time.time - initialCollapseTime < collapseTime)
{
yield return new WaitForSeconds(0.01f);
float collapseRate = (Time.time - initialCollapseTime) / collapseTime;
leftPress.transform.localScale = new Vector3(collapseRate * 20, 1, 1);
rightPress.transform.localScale = new Vector3(-collapseRate * 20, 1, 1);
}
for (int x = 0; x < width; x++)
{
Destroy(mapGrid[x, row].gameObject);
mapGrid[x, row] = null;
}
isRowDeleting[row] = false;
DecreaseRowsAbove(row);
Destroy(leftPress);
Destroy(rightPress);
}
/// <summary> /// <summary>
/// Decrease all rows above this row. /// Decrease all rows above this row.
/// </summary> /// </summary>
...@@ -483,7 +527,7 @@ public class MapManager : MonoBehaviour { ...@@ -483,7 +527,7 @@ public class MapManager : MonoBehaviour {
} }
// Use this for initialization // Use this for initialization
void Start () { void Start () {
} }
// Update is called once per frame // Update is called once per frame
......
...@@ -2,7 +2,17 @@ ...@@ -2,7 +2,17 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class Press : MonoBehaviour { public class Press : MonoBehaviour
{
/*
* variables
* */
/// <summary>
/// If this press is on left side or not.
/// </summary>
public bool isLeft;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
......
...@@ -126,7 +126,7 @@ public class TetriminoSpawner : MonoBehaviour { ...@@ -126,7 +126,7 @@ public class TetriminoSpawner : MonoBehaviour {
} }
// Use this for initialization // Use this for initialization
void Start () { void Start () {
} }
// Update is called once per frame // Update is called once per frame
......
fileFormatVersion: 2
guid: c6beb369e5ae4e54c9be6a3318849ca0
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: -1
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: 10.666667
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: 8aa4b6fb863999b469589bb24813010d
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ba3eb4a3ac9f75f40b3cb8334e048476
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment