Commit be57d90b authored by 18손재민's avatar 18손재민

방 이동할 때 버그 수정, 이제 포탈을 사용할 땐 테트리미노가 떨어지거나 프레스가 작동하는등의 기능이 정지함. 또 프레스가 생성된 줄의 포탈은 즉시 삭제됨

parent cd735704
...@@ -51,4 +51,5 @@ MonoBehaviour: ...@@ -51,4 +51,5 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 97912f0a2214a8a4f8023ed30629bb30, type: 3} m_Script: {fileID: 11500000, guid: 97912f0a2214a8a4f8023ed30629bb30, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
gameOverScreen: {fileID: 0} gameOverScreen: {fileID: 223237664237935382, guid: 692aad2449e06054799ea4706578fb23,
type: 2}
%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: 1742875678731534}
m_IsPrefabAsset: 1
--- !u!1 &1477485121973492
GameObject:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 224101257581314510}
- component: {fileID: 222962373913678816}
- component: {fileID: 114559829250761616}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1494987781166378
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 224781783398162196}
- component: {fileID: 222552088602248600}
- component: {fileID: 114217847818790192}
- component: {fileID: 114630214332230992}
m_Layer: 5
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1702840344177108
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 224468892099411304}
- component: {fileID: 222041283436475362}
- component: {fileID: 114992008157603866}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1731908044050396
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 224439999180110808}
- component: {fileID: 222705533644723736}
- component: {fileID: 114655488217341162}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1742875678731534
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 224393982547383572}
- component: {fileID: 223237664237935382}
- component: {fileID: 114329367960331390}
- component: {fileID: 114670192621150284}
m_Layer: 5
m_Name: GameOverScreen
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!114 &114217847818790192
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1494987781166378}
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 &114329367960331390
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1742875678731534}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!114 &114559829250761616
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1477485121973492}
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: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 5
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Yes
--- !u!114 &114630214332230992
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1494987781166378}
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: 114217847818790192}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_MethodName: RestartGame
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 &114655488217341162
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1731908044050396}
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: 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_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 5
m_MaxSize: 50
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'Game Over!
Retry?'
--- !u!114 &114670192621150284
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1742875678731534}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &114992008157603866
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1702840344177108}
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: 0, g: 0, b: 0, a: 0.78431374}
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: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &222041283436475362
CanvasRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1702840344177108}
m_CullTransparentMesh: 0
--- !u!222 &222552088602248600
CanvasRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1494987781166378}
m_CullTransparentMesh: 0
--- !u!222 &222705533644723736
CanvasRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1731908044050396}
m_CullTransparentMesh: 0
--- !u!222 &222962373913678816
CanvasRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1477485121973492}
m_CullTransparentMesh: 0
--- !u!223 &223237664237935382
Canvas:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1742875678731534}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &224101257581314510
RectTransform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1477485121973492}
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: 224781783398162196}
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 &224393982547383572
RectTransform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1742875678731534}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 224468892099411304}
- {fileID: 224781783398162196}
- {fileID: 224439999180110808}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!224 &224439999180110808
RectTransform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1731908044050396}
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: 224393982547383572}
m_RootOrder: 2
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: 0, y: 150}
m_SizeDelta: {x: 300, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224468892099411304
RectTransform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1702840344177108}
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: 224393982547383572}
m_RootOrder: 0
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: 0, y: 0}
m_SizeDelta: {x: 1920, y: 1080}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224781783398162196
RectTransform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1494987781166378}
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: 224101257581314510}
m_Father: {fileID: 224393982547383572}
m_RootOrder: 1
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: 0, y: 0}
m_SizeDelta: {x: 250, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
fileFormatVersion: 2
guid: 692aad2449e06054799ea4706578fb23
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
...@@ -93,18 +93,6 @@ public class CameraController : MonoBehaviour { ...@@ -93,18 +93,6 @@ public class CameraController : MonoBehaviour {
else if(gameState == GameState.Portal) else if(gameState == GameState.Portal)
{ {
GameManager.gameState = GameState.Portal; GameManager.gameState = GameState.Portal;
for (int x = 0; x < MapManager.width; x++)
MapManager.portalDistributedHorizontal[x].Clear();
for (int y = 0; y <= MapManager.realHeight; y++)
MapManager.portalDistributedVertical[y].Clear();
for (int x = 0; x < MapManager.width; x++)
for (int y = 0; y <= MapManager.realHeight; y++)
if (MapManager.mapGrid[x, y] != null && MapManager.mapGrid[x, y].isPortal == true)
{
MapManager.portalGrid[x, y] = true;
MapManager.portalDistributedHorizontal[x].Add(y);
MapManager.portalDistributedVertical[y].Add(x);
}
MapManager.portalDestination = MapManager.currentRoom.mapCoord; MapManager.portalDestination = MapManager.currentRoom.mapCoord;
MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y].portalSurface.GetComponent<SpriteRenderer>().sprite = MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y].portalSurface.GetComponent<SpriteRenderer>().sprite =
GameObject.Find("MapManager").GetComponent<MapManager>().portalSelected; GameObject.Find("MapManager").GetComponent<MapManager>().portalSelected;
......
...@@ -8,8 +8,6 @@ public class Player : MonoBehaviour { ...@@ -8,8 +8,6 @@ public class Player : MonoBehaviour {
public static float X=0.7f, Y=1.6f; public static float X=0.7f, Y=1.6f;
public int ttx; public int ttx;
public int tty; public int tty;
Coroutine roomEnterFadeIn;
Coroutine roomExitFadeOut;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
......
...@@ -85,7 +85,7 @@ public class PlayerController : MonoBehaviour ...@@ -85,7 +85,7 @@ public class PlayerController : MonoBehaviour
{ {
isGrounded = IsGrounded(); isGrounded = IsGrounded();
if (GameManager.gameState == GameState.Ingame) if (GameManager.gameState == GameState.Ingame && MapManager.isDoorClosing != true)
{ {
if (isGrounded) if (isGrounded)
......
...@@ -32,7 +32,9 @@ public class GameManager : MonoBehaviour { ...@@ -32,7 +32,9 @@ public class GameManager : MonoBehaviour {
// Update is called once per frame // Update is called once per frame
void Update () void Update ()
{ {
if (Input.GetKeyDown(KeyCode.Tab) && CameraController.isSceneChanging != true) if(CameraController.isSceneChanging != true)
{
if (Input.GetKeyDown(KeyCode.Tab))
{ {
if (gameState == GameState.Ingame) if (gameState == GameState.Ingame)
{ {
...@@ -43,9 +45,9 @@ public class GameManager : MonoBehaviour { ...@@ -43,9 +45,9 @@ public class GameManager : MonoBehaviour {
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Ingame)); StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Ingame));
} }
} }
if (Input.GetKeyDown(KeyCode.Escape) && CameraController.isSceneChanging != true) if (Input.GetKeyDown(KeyCode.F))
{ {
if (gameState == GameState.Portal) if (gameState == GameState.Portal && MapManager.currentRoom != MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y])
{ {
GameObject.Find("Player").transform.position = MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y].portal.transform.position + new Vector3(2, 1, 0); GameObject.Find("Player").transform.position = MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y].portal.transform.position + new Vector3(2, 1, 0);
GameObject.Find("MapManager").GetComponent<MapManager>().ChangeRoom(MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y]); GameObject.Find("MapManager").GetComponent<MapManager>().ChangeRoom(MapManager.mapGrid[(int)MapManager.portalDestination.x, (int)MapManager.portalDestination.y]);
...@@ -54,6 +56,13 @@ public class GameManager : MonoBehaviour { ...@@ -54,6 +56,13 @@ public class GameManager : MonoBehaviour {
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Ingame)); StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Ingame));
} }
} }
if (Input.GetKeyDown(KeyCode.Escape))
{
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));
}
}
if(gameState == GameState.GameOver) if(gameState == GameState.GameOver)
{ {
if(gameOverScreen.isActiveAndEnabled == false) if(gameOverScreen.isActiveAndEnabled == false)
......
...@@ -5,7 +5,6 @@ using UnityEngine; ...@@ -5,7 +5,6 @@ using UnityEngine;
public class MapManager : MonoBehaviour { public class MapManager : MonoBehaviour {
public static bool isDoorClosing = false;
/* /*
* variables * variables
* */ * */
...@@ -82,6 +81,10 @@ public class MapManager : MonoBehaviour { ...@@ -82,6 +81,10 @@ public class MapManager : MonoBehaviour {
/// </summary> /// </summary>
public static bool isRoomFalling = false; public static bool isRoomFalling = false;
/// <summary> /// <summary>
/// Check if door is closing or not.
/// </summary>
public static bool isDoorClosing = false;
/// <summary>
/// Check if this row is being deleted. /// Check if this row is being deleted.
/// </summary> /// </summary>
public static bool[] isRowDeleting = new bool[20]; public static bool[] isRowDeleting = new bool[20];
...@@ -303,12 +306,26 @@ public class MapManager : MonoBehaviour { ...@@ -303,12 +306,26 @@ public class MapManager : MonoBehaviour {
int roomDestroyCounter = 0; int roomDestroyCounter = 0;
int row = leftPress.row; int row = leftPress.row;
float collapseSpeed = (float)20 / collapseTime * Time.deltaTime; float collapseSpeed = (float)20 / collapseTime * Time.deltaTime;
portalDistributedVertical[row].Clear();
for(int i = 0; i < portalDistributedHorizontal.Length; i++)
portalDistributedHorizontal[i].Remove(row);
for(int i = 0; i < width; i++)
if (mapGrid[i, row].isPortal == true)
{
mapGrid[i, row].isPortal = false;
Destroy(mapGrid[i, row].portalSurface);
mapGrid[i, row].portal.SetActive(false);
}
leftPress.transform.localScale = new Vector3(0, 1, 1); leftPress.transform.localScale = new Vector3(0, 1, 1);
rightPress.transform.localScale = new Vector3(0, 1, 1); rightPress.transform.localScale = new Vector3(0, 1, 1);
float collapseRate = leftPress.transform.localScale.x; float collapseRate = leftPress.transform.localScale.x;
while (collapseRate < 20) while (collapseRate < 20)
{
while (GameManager.gameState == GameState.Portal)
{ {
yield return null; yield return null;
}
yield return null;
if (currentRoom.mapCoord.y == row) if (currentRoom.mapCoord.y == row)
collapseSpeed = (float)2 / collapseTime * Time.deltaTime; collapseSpeed = (float)2 / collapseTime * Time.deltaTime;
else else
...@@ -427,6 +444,10 @@ public class MapManager : MonoBehaviour { ...@@ -427,6 +444,10 @@ public class MapManager : MonoBehaviour {
Vector3 previousPlayerRelativePosition = player.transform.position - currentRoom.transform.position; Vector3 previousPlayerRelativePosition = player.transform.position - currentRoom.transform.position;
while (tetrisYCoord[top + 1] > bottom * tetrisMapSize) while (tetrisYCoord[top + 1] > bottom * tetrisMapSize)
{ {
while (GameManager.gameState == GameState.Portal)
{
yield return null;
}
yield return new WaitForSeconds(0.01f); yield return new WaitForSeconds(0.01f);
if (isRowDeleting[top + 1]) if (isRowDeleting[top + 1])
{ {
...@@ -513,6 +534,11 @@ public class MapManager : MonoBehaviour { ...@@ -513,6 +534,11 @@ public class MapManager : MonoBehaviour {
{ {
while (!isTetriminoFalling) while (!isTetriminoFalling)
{ {
while (GameManager.gameState == GameState.Portal)
{
tetriminoCreatedTime += Time.deltaTime;
yield return null;
}
yield return new WaitForSeconds(0.1f); yield return new WaitForSeconds(0.1f);
tetriminoWaitedTime = Time.time - tetriminoCreatedTime; tetriminoWaitedTime = Time.time - tetriminoCreatedTime;
} }
...@@ -636,6 +662,10 @@ public class MapManager : MonoBehaviour { ...@@ -636,6 +662,10 @@ public class MapManager : MonoBehaviour {
{ {
while(te.transform.position.y > tetrisYCoord[(int)te.mapCoord.y]) while(te.transform.position.y > tetrisYCoord[(int)te.mapCoord.y])
{ {
while (GameManager.gameState == GameState.Portal)
{
yield return null;
}
yield return new WaitForSeconds(0.01f); yield return new WaitForSeconds(0.01f);
fallTime = Time.time - initialFallTime; fallTime = Time.time - initialFallTime;
fallSpeed += gravity * fallTime * fallTime; fallSpeed += gravity * fallTime * fallTime;
...@@ -819,6 +849,8 @@ public class MapManager : MonoBehaviour { ...@@ -819,6 +849,8 @@ public class MapManager : MonoBehaviour {
float alpha = 1; float alpha = 1;
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
if(i == 6)
isDoorClosing = false;
yield return new WaitForSeconds(0.01f); yield return new WaitForSeconds(0.01f);
room.leftTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, alpha); room.leftTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, alpha);
room.rightTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, alpha); room.rightTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, alpha);
...@@ -828,7 +860,6 @@ public class MapManager : MonoBehaviour { ...@@ -828,7 +860,6 @@ public class MapManager : MonoBehaviour {
room.leftTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0); room.leftTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
room.rightTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0); room.rightTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
room.fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0); room.fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
isDoorClosing = false;
} }
/// <summary> /// <summary>
/// Make room fade out. /// Make room fade out.
...@@ -850,10 +881,9 @@ public class MapManager : MonoBehaviour { ...@@ -850,10 +881,9 @@ public class MapManager : MonoBehaviour {
room.rightTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 1); room.rightTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 1);
room.fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 1); room.fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 1);
} }
/// <summary>
/// Control portal's move.
/// </summary>
public void PortalControl() public void PortalControl()
{ {
int minDifference = 100; int minDifference = 100;
......
...@@ -7,8 +7,10 @@ public class Portal : MonoBehaviour { ...@@ -7,8 +7,10 @@ public class Portal : MonoBehaviour {
private void OnTriggerStay2D(Collider2D collision) private void OnTriggerStay2D(Collider2D collision)
{ {
if (collision.tag.Equals("Player") && Input.GetKeyDown(KeyCode.F)) if (collision.tag.Equals("Player") && Input.GetKeyDown(KeyCode.F))
{
StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Portal)); StartCoroutine(GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>().ChangeScene(GameState.Portal));
} }
}
// Use this for initialization // Use this for initialization
void Start () { void Start () {
......
...@@ -384,7 +384,21 @@ public class Room : MonoBehaviour ...@@ -384,7 +384,21 @@ public class Room : MonoBehaviour
fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0); fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
CreatePortal(); CreatePortal();
if (isPortal == true) if (isPortal == true)
{
for (int x = 0; x < MapManager.width; x++)
MapManager.portalDistributedHorizontal[x].Clear();
for (int y = 0; y <= MapManager.realHeight; y++)
MapManager.portalDistributedVertical[y].Clear();
for (int x = 0; x < MapManager.width; x++)
for (int y = 0; y <= MapManager.realHeight; y++)
if (MapManager.mapGrid[x, y] != null && MapManager.mapGrid[x, y].isPortal == true)
{
MapManager.portalGrid[x, y] = true;
MapManager.portalDistributedHorizontal[x].Add(y);
MapManager.portalDistributedVertical[y].Add(x);
}
portalSurface = Instantiate(GameObject.Find("MapManager").GetComponent<MapManager>().portalSurface, transform.position + new Vector3(12, 12, 0), Quaternion.identity, transform); portalSurface = Instantiate(GameObject.Find("MapManager").GetComponent<MapManager>().portalSurface, transform.position + new Vector3(12, 12, 0), Quaternion.identity, transform);
}
isRoomCleared = true; isRoomCleared = true;
if (specialRoomType == RoomType.Boss) if (specialRoomType == RoomType.Boss)
MapManager.currentStage += 1; MapManager.currentStage += 1;
......
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