Commit 1954058a authored by 18손재민's avatar 18손재민

승리 조건 버그 고치고 게임 재시작 시 씬 리로드하는 것으로 고침. 이제 카메라 터렛에 닿으면 클리어 여부와 관계 없이 게임 오버 됨

parent d4320995
...@@ -89,7 +89,6 @@ GameObject: ...@@ -89,7 +89,6 @@ GameObject:
- component: {fileID: 2534561534465045041} - component: {fileID: 2534561534465045041}
- component: {fileID: 2534561534464242193} - component: {fileID: 2534561534464242193}
- component: {fileID: 2534561534463275217} - component: {fileID: 2534561534463275217}
- component: {fileID: -2850530927027858165}
- component: {fileID: -4559840392902712278} - component: {fileID: -4559840392902712278}
- component: {fileID: -954323813722370706} - component: {fileID: -954323813722370706}
m_Layer: 13 m_Layer: 13
...@@ -162,19 +161,6 @@ MeshRenderer: ...@@ -162,19 +161,6 @@ MeshRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!65 &-2850530927027858165
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2534561534465535505}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.52, y: 0.44944128, z: 0.1252539}
m_Center: {x: 0, y: 0.030357078, z: 0}
--- !u!114 &-4559840392902712278 --- !u!114 &-4559840392902712278
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -422,6 +422,85 @@ MonoBehaviour: ...@@ -422,6 +422,85 @@ MonoBehaviour:
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: add mannequin m_Text: add mannequin
--- !u!1 &1854540597
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1854540598}
- component: {fileID: 1854540600}
- component: {fileID: 1854540599}
m_Layer: 5
m_Name: Clear
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &1854540598
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1854540597}
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: 1444571407667829093}
m_RootOrder: 7
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: 500, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1854540600
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1854540597}
m_CullTransparentMesh: 0
--- !u!114 &1854540599
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1854540597}
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: 90
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 200
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Stage Clear!
--- !u!1 &356685241964599882 --- !u!1 &356685241964599882
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -961,6 +1040,7 @@ RectTransform: ...@@ -961,6 +1040,7 @@ RectTransform:
- {fileID: 1444571407224148019} - {fileID: 1444571407224148019}
- {fileID: 1444571408487427164} - {fileID: 1444571408487427164}
- {fileID: 1466596363} - {fileID: 1466596363}
- {fileID: 1854540598}
m_Father: {fileID: 1444571408780882984} m_Father: {fileID: 1444571408780882984}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
...@@ -1508,6 +1588,7 @@ MonoBehaviour: ...@@ -1508,6 +1588,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
currentBullet: {fileID: 3656934010764012818} currentBullet: {fileID: 3656934010764012818}
clear: {fileID: 1854540599}
xInput: {fileID: 1444571407224148016} xInput: {fileID: 1444571407224148016}
yInput: {fileID: 1444571408487427165} yInput: {fileID: 1444571408487427165}
--- !u!1 &1444571408874085630 --- !u!1 &1444571408874085630
......
{"objects":[{"tag":0,"xPos":25.0,"yPos":0.0},{"tag":2,"xPos":-2.0,"yPos":1.5},{"tag":2,"xPos":-1.0,"yPos":1.5},{"tag":3,"xPos":0.0,"yPos":1.5},{"tag":3,"xPos":1.0,"yPos":1.5},{"tag":1,"xPos":0.0,"yPos":0.0},{"tag":1,"xPos":0.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":0.0},{"tag":1,"xPos":-2.0,"yPos":2.0},{"tag":1,"xPos":-2.0,"yPos":1.0},{"tag":1,"xPos":-1.0,"yPos":1.0},{"tag":1,"xPos":-1.0,"yPos":2.0},{"tag":1,"xPos":0.0,"yPos":2.0},{"tag":1,"xPos":0.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":1.0},{"tag":1,"xPos":2.0,"yPos":0.0},{"tag":1,"xPos":2.0,"yPos":-1.0},{"tag":1,"xPos":2.0,"yPos":-2.0},{"tag":1,"xPos":1.0,"yPos":-2.0},{"tag":1,"xPos":0.0,"yPos":-2.0},{"tag":1,"xPos":-1.0,"yPos":-2.0},{"tag":1,"xPos":-1.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-1.0},{"tag":9,"xPos":-2.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":0.0},{"tag":9,"xPos":-2.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":0.0},{"tag":4,"xPos":-2.0,"yPos":-2.0},{"tag":4,"xPos":-1.0,"yPos":-2.0},{"tag":6,"xPos":2.0,"yPos":2.0},{"tag":7,"xPos":2.0,"yPos":1.0},{"tag":8,"xPos":2.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":1.0},{"tag":5,"xPos":1.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":-1.0},{"tag":5,"xPos":1.0,"yPos":-2.0}],"clears":[],"cases":[3,0,1,2],"bullets":[0,1,2]} {"objects":[{"tag":0,"xPos":20.0,"yPos":0.0},{"tag":3,"xPos":-0.5,"yPos":0.0},{"tag":2,"xPos":-0.5,"yPos":1.0},{"tag":2,"xPos":-0.5,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":1.0},{"tag":1,"xPos":-2.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":1.0},{"tag":1,"xPos":0.0,"yPos":1.0},{"tag":1,"xPos":0.0,"yPos":0.0},{"tag":1,"xPos":1.0,"yPos":0.0},{"tag":1,"xPos":1.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":-2.0},{"tag":1,"xPos":0.0,"yPos":-2.0},{"tag":1,"xPos":0.0,"yPos":-1.0},{"tag":1,"xPos":-1.0,"yPos":-1.0},{"tag":1,"xPos":-1.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":-1.0},{"tag":4,"xPos":1.0,"yPos":-2.0},{"tag":6,"xPos":1.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":1.0}],"clears":[{"type":2,"goal":1}],"cases":[3],"bullets":[1]}
\ No newline at end of file \ No newline at end of file
{"objects":[{"tag":0,"xPos":25.0,"yPos":0.0},{"tag":2,"xPos":-2.0,"yPos":1.5},{"tag":2,"xPos":-1.0,"yPos":1.5},{"tag":3,"xPos":0.0,"yPos":1.5},{"tag":3,"xPos":1.0,"yPos":1.5},{"tag":1,"xPos":0.0,"yPos":0.0},{"tag":1,"xPos":0.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":0.0},{"tag":1,"xPos":-2.0,"yPos":2.0},{"tag":1,"xPos":-2.0,"yPos":1.0},{"tag":1,"xPos":-1.0,"yPos":1.0},{"tag":1,"xPos":-1.0,"yPos":2.0},{"tag":1,"xPos":0.0,"yPos":2.0},{"tag":1,"xPos":0.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":1.0},{"tag":1,"xPos":2.0,"yPos":0.0},{"tag":1,"xPos":2.0,"yPos":-1.0},{"tag":1,"xPos":2.0,"yPos":-2.0},{"tag":1,"xPos":1.0,"yPos":-2.0},{"tag":1,"xPos":0.0,"yPos":-2.0},{"tag":1,"xPos":-1.0,"yPos":-2.0},{"tag":1,"xPos":-1.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-1.0},{"tag":9,"xPos":-2.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":0.0},{"tag":9,"xPos":-2.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":0.0},{"tag":4,"xPos":-2.0,"yPos":-2.0},{"tag":4,"xPos":-1.0,"yPos":-2.0},{"tag":6,"xPos":2.0,"yPos":2.0},{"tag":7,"xPos":2.0,"yPos":1.0},{"tag":8,"xPos":2.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":1.0},{"tag":5,"xPos":1.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":-1.0},{"tag":5,"xPos":1.0,"yPos":-2.0}],"clears":[],"cases":[3,0,1,2],"bullets":[0,1,2]} {"objects":[{"tag":0,"xPos":20.0,"yPos":0.0},{"tag":2,"xPos":-2.0,"yPos":-0.5},{"tag":2,"xPos":-1.0,"yPos":-0.5},{"tag":2,"xPos":0.5,"yPos":-1.0},{"tag":3,"xPos":0.0,"yPos":-0.5},{"tag":3,"xPos":1.0,"yPos":-0.5},{"tag":1,"xPos":0.0,"yPos":0.0},{"tag":1,"xPos":-2.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":1.0},{"tag":1,"xPos":-2.0,"yPos":1.0},{"tag":1,"xPos":-2.0,"yPos":-1.0},{"tag":1,"xPos":-1.0,"yPos":-1.0},{"tag":1,"xPos":-1.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":-2.0},{"tag":1,"xPos":0.0,"yPos":-2.0},{"tag":1,"xPos":0.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":-2.0},{"tag":1,"xPos":1.0,"yPos":0.0},{"tag":1,"xPos":1.0,"yPos":1.0},{"tag":1,"xPos":0.0,"yPos":1.0},{"tag":4,"xPos":-2.0,"yPos":-2.0},{"tag":6,"xPos":1.0,"yPos":-1.0},{"tag":5,"xPos":1.0,"yPos":-2.0}],"clears":[{"type":6,"goal":1}],"cases":[3],"bullets":[1,1]}
\ No newline at end of file \ No newline at end of file
fileFormatVersion: 2 fileFormatVersion: 2
guid: b65159d8e62109d4990676399736ddbf guid: a0bbdbca5d3d3904b8af6f4f7266190d
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
......
{"objects":[{"tag":0,"xPos":25.0,"yPos":0.0},{"tag":2,"xPos":-2.0,"yPos":1.5},{"tag":2,"xPos":-1.0,"yPos":1.5},{"tag":3,"xPos":0.0,"yPos":1.5},{"tag":3,"xPos":1.0,"yPos":1.5},{"tag":1,"xPos":0.0,"yPos":0.0},{"tag":1,"xPos":0.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":0.0},{"tag":1,"xPos":-2.0,"yPos":2.0},{"tag":1,"xPos":-2.0,"yPos":1.0},{"tag":1,"xPos":-1.0,"yPos":1.0},{"tag":1,"xPos":-1.0,"yPos":2.0},{"tag":1,"xPos":0.0,"yPos":2.0},{"tag":1,"xPos":0.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":1.0},{"tag":1,"xPos":2.0,"yPos":0.0},{"tag":1,"xPos":2.0,"yPos":-1.0},{"tag":1,"xPos":2.0,"yPos":-2.0},{"tag":1,"xPos":1.0,"yPos":-2.0},{"tag":1,"xPos":0.0,"yPos":-2.0},{"tag":1,"xPos":-1.0,"yPos":-2.0},{"tag":1,"xPos":-1.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-1.0},{"tag":9,"xPos":-2.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":0.0},{"tag":9,"xPos":-2.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":0.0},{"tag":4,"xPos":-2.0,"yPos":-2.0},{"tag":4,"xPos":-1.0,"yPos":-2.0},{"tag":6,"xPos":2.0,"yPos":2.0},{"tag":7,"xPos":2.0,"yPos":1.0},{"tag":8,"xPos":2.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":1.0},{"tag":5,"xPos":1.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":-1.0},{"tag":5,"xPos":1.0,"yPos":-2.0}],"clears":[],"cases":[3,0,1,2],"bullets":[0,1,2]}
\ No newline at end of file
fileFormatVersion: 2
guid: a0bbdbca5d3d3904b8af6f4f7266190d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -153,6 +153,7 @@ MonoBehaviour: ...@@ -153,6 +153,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
clearUI: {fileID: 4890012631615838995, guid: 874af447cef689e478ca96b4d1d197c2, type: 3} clearUI: {fileID: 4890012631615838995, guid: 874af447cef689e478ca96b4d1d197c2, type: 3}
uiList: []
--- !u!114 &158856769 --- !u!114 &158856769
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -305,7 +306,7 @@ Light: ...@@ -305,7 +306,7 @@ Light:
m_BounceIntensity: 1 m_BounceIntensity: 1
m_ColorTemperature: 6570 m_ColorTemperature: 6570
m_UseColorTemperature: 0 m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0.03125, y: 0.109375, z: 0.03125, w: -0.03125} m_BoundingSphereOverride: {x: -Infinity, y: 2.8421708e-14, z: 0, w: 2.69e-43}
m_UseBoundingSphereOverride: 0 m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0 m_ShadowRadius: 0
m_ShadowAngle: 0 m_ShadowAngle: 0
......
...@@ -50,6 +50,8 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor ...@@ -50,6 +50,8 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
} }
public void Interact(Vector2Int position) public void Interact(Vector2Int position)
{
if(!GameManager.inst.isGameOver)
{ {
Debug.Log(Position + " " + position); Debug.Log(Position + " " + position);
if (Position == position) if (Position == position)
...@@ -61,8 +63,10 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor ...@@ -61,8 +63,10 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
if (GameManager.nCase >= 0) if (GameManager.nCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.nCase].IsDone(1); MapManager.inst.currentMap.clearConditions[GameManager.nCase].IsDone(1);
floor.objOnFloor = null; floor.objOnFloor = null;
MapManager.inst.currentMap.RemoveObject(Position); MapManager.inst.currentMap.RemoveObject(Position, true);
}
} }
} }
ObjType IObject.GetType() ObjType IObject.GetType()
......
...@@ -13,6 +13,7 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto ...@@ -13,6 +13,7 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
this.floor = floor; this.floor = floor;
floor.objOnFloor = this; floor.objOnFloor = this;
PlayerController.inst.OnPlayerMove += Interact; PlayerController.inst.OnPlayerMove += Interact;
if (GameManager.aTurret >= 0) MapManager.inst.currentMap.clearConditions[GameManager.aTurret].IsDone(0, 1);
} }
public void Break() public void Break()
...@@ -25,14 +26,19 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto ...@@ -25,14 +26,19 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
} }
public void Interact(Vector2Int pos) public void Interact(Vector2Int pos)
{
if(!GameManager.inst.isGameOver)
{ {
if (Position.IsInAdjacentArea(pos, 1) && MapManager.inst.currentMap.GetWallAtPos((Vector2)(Position + pos) / 2) == null) if (Position.IsInAdjacentArea(pos, 1) && MapManager.inst.currentMap.GetWallAtPos((Vector2)(Position + pos) / 2) == null)
{ {
GameManager.inst.isGameOver = true;
StartCoroutine(GameManager.inst.RestartStage()); StartCoroutine(GameManager.inst.RestartStage());
GameManager.inst.uiGenerator.ResetAllClearUIs();
//TODO : Restart Level //TODO : Restart Level
} }
} }
}
public GameObject GetObject() public GameObject GetObject()
{ {
......
...@@ -68,16 +68,17 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor ...@@ -68,16 +68,17 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
this.floor = floor; this.floor = floor;
floor.objOnFloor = this; floor.objOnFloor = this;
transform.Rotate(new Vector3(0, Random.Range(0, 4) * 90, 0)); transform.Rotate(new Vector3(0, Random.Range(0, 4) * 90, 0));
isWhite = true;
Color = Color.white;
if (GameManager.white >= 0) MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(1);
} }
public void SetColor(bool isWhite) public void SetColor(bool isWhite)
{ {
Color = isWhite ? Color.white : Color.black; Color = isWhite ? Color.white : Color.black;
this.isWhite = isWhite; this.isWhite = isWhite;
if (GameManager.white >= 0 && isWhite) if (GameManager.white >= 0 && isWhite) MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(1);
MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(1); if (GameManager.black >= 0 && !isWhite) MapManager.inst.currentMap.clearConditions[GameManager.black].IsDone(1);
if (GameManager.black >= 0 && !isWhite)
MapManager.inst.currentMap.clearConditions[GameManager.black].IsDone(1);
} }
#region IObject Override #region IObject Override
......
...@@ -6,6 +6,7 @@ using UnityEngine.SceneManagement; ...@@ -6,6 +6,7 @@ using UnityEngine.SceneManagement;
public class GameManager : SingletonBehaviour<GameManager> public class GameManager : SingletonBehaviour<GameManager>
{ {
public ClearUIGenerator uiGenerator; public ClearUIGenerator uiGenerator;
public bool isGameOver = false;
public int[] clearIndex = new int[9]; public int[] clearIndex = new int[9];
public int clearCounter = 0; public int clearCounter = 0;
...@@ -47,39 +48,43 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -47,39 +48,43 @@ public class GameManager : SingletonBehaviour<GameManager>
MapManager.inst.LoadMap(currentStage); MapManager.inst.LoadMap(currentStage);
} }
public void ClearStage() public IEnumerator ClearStage()
{ {
GameObject.Find("TestTools").GetComponent<TestTools>().clear.gameObject.SetActive(true);
Debug.Log("Stage Clear!"); Debug.Log("Stage Clear!");
yield return new WaitForSeconds(3);
BackToStageSelect();
} }
public void GameOver() public void GameOver()
{ {
Debug.Log("Game Over!"); Debug.Log("Game Over!");
StopAllCoroutines(); StopAllCoroutines();
foreach (GameObject child in MapManager.inst.players)
Destroy(child);
Destroy(MapManager.inst.currentMap.gameObject);
} }
public IEnumerator RestartStage() public IEnumerator RestartStage()
{ {
Debug.Log("Game Restart!"); Debug.Log("Game Restart!");
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f);
GameOver(); SceneManager.LoadScene(SceneManager.GetActiveScene().name);
StartStage();
} }
public void BackToStageSelect() public void BackToStageSelect()
{ {
GameOver(); Destroy(FindObjectOfType<StageSelector>().gameObject);
SceneManager.LoadScene("SelectStage"); SceneManager.LoadScene("SelectStage");
} }
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
if (!MapManager.inst.isMapEditingOn)
{
isGameOver = false;
currentStage = Resources.Load<TextAsset>("Stages/" + "stage" + (StageSelector.selectedStage + 1)); currentStage = Resources.Load<TextAsset>("Stages/" + "stage" + (StageSelector.selectedStage + 1));
StartStage(); StartStage();
Destroy(FindObjectOfType<StageSelector>().gameObject); //Destroy(FindObjectOfType<StageSelector>().gameObject);
}
} }
} }
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
[System.Serializable] [System.Serializable]
public class ClearCondition public class ClearCondition
{ {
...@@ -32,7 +31,7 @@ public class ClearCondition ...@@ -32,7 +31,7 @@ public class ClearCondition
Debug.Log(GameManager.inst.clearCounter); Debug.Log(GameManager.inst.clearCounter);
assignedClearUI.RefreshClearCondition(); assignedClearUI.RefreshClearCondition();
if (GameManager.inst.clearCounter == 0) if (GameManager.inst.clearCounter == 0)
GameManager.inst.ClearStage(); GameManager.inst.StartCoroutine(GameManager.inst.ClearStage());
} }
else if (goal > count && isDone) else if (goal > count && isDone)
{ {
......
...@@ -223,13 +223,9 @@ public class Map : MonoBehaviour ...@@ -223,13 +223,9 @@ public class Map : MonoBehaviour
{ {
case ObjType.Briefcase: case ObjType.Briefcase:
objectGrid.Add(pos, Instantiate(MapManager.inst.briefCase, new Vector3(pos.x, 0.5f, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>()); objectGrid.Add(pos, Instantiate(MapManager.inst.briefCase, new Vector3(pos.x, 0.5f, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>());
if (GameManager.aCase >= 0)
clearConditions[GameManager.aCase].IsDone(0, 1);
break; break;
case ObjType.Camera: case ObjType.Camera:
objectGrid.Add(pos, Instantiate(MapManager.inst.cameraTurret, new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>()); objectGrid.Add(pos, Instantiate(MapManager.inst.cameraTurret, new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>());
if (GameManager.aTurret >= 0)
clearConditions[GameManager.aTurret].IsDone(0, 1);
break; break;
case ObjType.Mannequin: case ObjType.Mannequin:
objectGrid.Add(pos, Instantiate(MapManager.inst.mannequins[Random.Range(0, 5)], new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>()); objectGrid.Add(pos, Instantiate(MapManager.inst.mannequins[Random.Range(0, 5)], new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>());
...@@ -251,11 +247,11 @@ public class Map : MonoBehaviour ...@@ -251,11 +247,11 @@ public class Map : MonoBehaviour
/// Remove Object at position. /// Remove Object at position.
/// </summary> /// </summary>
/// <param name="pos">Position of object.</param> /// <param name="pos">Position of object.</param>
public void RemoveObject(Vector2Int pos) public void RemoveObject(Vector2Int pos, bool isCaseInteracted = false)
{ {
if (objectGrid.ContainsKey(pos)) if (objectGrid.ContainsKey(pos))
{ {
if(objectGrid[pos].GetType() == ObjType.Briefcase && GameManager.aCase >= 0) if(objectGrid[pos].GetType() == ObjType.Briefcase && GameManager.aCase >= 0 && !isCaseInteracted)
clearConditions[GameManager.aCase].IsDone(0, -1); clearConditions[GameManager.aCase].IsDone(0, -1);
else if (objectGrid[pos].GetType() == ObjType.Camera && GameManager.aTurret >= 0) else if (objectGrid[pos].GetType() == ObjType.Camera && GameManager.aTurret >= 0)
clearConditions[GameManager.aTurret].IsDone(0, -1); clearConditions[GameManager.aTurret].IsDone(0, -1);
......
...@@ -72,6 +72,9 @@ public class MapEditor : SingletonBehaviour<MapEditor> ...@@ -72,6 +72,9 @@ public class MapEditor : SingletonBehaviour<MapEditor>
/// <param name="_newMap"></param> /// <param name="_newMap"></param>
public void SaveMap(Map _newMap) public void SaveMap(Map _newMap)
{ {
/* 맵 저장 시 반드시 승리 조건 작성할 것
* 목표가 '모든'일 경우 승리 목표는 초기 맵 기준으로 작성
*/
System.DateTime time = System.DateTime.Now; System.DateTime time = System.DateTime.Now;
string localPath = "Assets/" + time.ToShortDateString() + "-" + time.Hour + "-" + time.Minute + "-" + time.Second + ".json"; string localPath = "Assets/" + time.ToShortDateString() + "-" + time.Hour + "-" + time.Minute + "-" + time.Second + ".json";
if(currentMap.startFloors.Count == 0) if(currentMap.startFloors.Count == 0)
......
...@@ -112,14 +112,6 @@ public class Player : MonoBehaviour ...@@ -112,14 +112,6 @@ public class Player : MonoBehaviour
PlayerController.inst.bulletList.RemoveAt(0); PlayerController.inst.bulletList.RemoveAt(0);
} }
private void OnTriggerEnter(Collider other)
{
if (other.GetComponent<IPlayerInteractor>() != null)
{
other.GetComponent<IPlayerInteractor>().Interact(currentFloor.mapPos);
}
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
......
...@@ -132,6 +132,8 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -132,6 +132,8 @@ public class PlayerController : SingletonBehaviour<PlayerController>
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{
if(!GameManager.inst.isGameOver)
{ {
if (prePos != MapPos) if (prePos != MapPos)
{ {
...@@ -146,7 +148,7 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -146,7 +148,7 @@ public class PlayerController : SingletonBehaviour<PlayerController>
if (Input.GetMouseButtonDown(0)) if (Input.GetMouseButtonDown(0))
{ {
//Move the current player. //Move the current player.
if(!isPlayerMoving && !isPlayerShooting) if (!isPlayerMoving && !isPlayerShooting)
{ {
Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit; RaycastHit hit;
...@@ -186,6 +188,7 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -186,6 +188,7 @@ public class PlayerController : SingletonBehaviour<PlayerController>
} }
} }
} }
}
void LateUpdate() void LateUpdate()
{ {
......
...@@ -20,6 +20,7 @@ public class StageSelector : MonoBehaviour ...@@ -20,6 +20,7 @@ public class StageSelector : MonoBehaviour
public void StartSelectedStage() public void StartSelectedStage()
{ {
gameObject.GetComponent<Canvas>().enabled = false;
SceneManager.LoadScene("PlayStage"); SceneManager.LoadScene("PlayStage");
} }
......
...@@ -5,7 +5,7 @@ using UnityEngine.UI; ...@@ -5,7 +5,7 @@ using UnityEngine.UI;
public class TestTools : MonoBehaviour public class TestTools : MonoBehaviour
{ {
public Text currentBullet; public Text currentBullet, clear;
public InputField xInput, yInput; public InputField xInput, yInput;
public void AddFloor() public void AddFloor()
......
...@@ -5,6 +5,7 @@ using UnityEngine; ...@@ -5,6 +5,7 @@ using UnityEngine;
public class ClearUIGenerator : MonoBehaviour public class ClearUIGenerator : MonoBehaviour
{ {
public GameObject clearUI; public GameObject clearUI;
public List<GameObject> uiList;
private int nextx = -175; private int nextx = -175;
private int nexty = -100; private int nexty = -100;
...@@ -14,7 +15,9 @@ public class ClearUIGenerator : MonoBehaviour ...@@ -14,7 +15,9 @@ public class ClearUIGenerator : MonoBehaviour
{ {
foreach (ClearCondition cond in MapManager.inst.currentMap.clearConditions) foreach (ClearCondition cond in MapManager.inst.currentMap.clearConditions)
{ {
ClearStatusUI ui = Instantiate(clearUI, transform).GetComponent<ClearStatusUI>(); GameObject uiObject = Instantiate(clearUI, transform);
uiList.Add(uiObject);
ClearStatusUI ui = uiObject.GetComponent<ClearStatusUI>();
ui.GetComponent<RectTransform>().anchoredPosition = new Vector2(nextx, nexty); ui.GetComponent<RectTransform>().anchoredPosition = new Vector2(nextx, nexty);
nexty -= 200; nexty -= 200;
...@@ -57,4 +60,14 @@ public class ClearUIGenerator : MonoBehaviour ...@@ -57,4 +60,14 @@ public class ClearUIGenerator : MonoBehaviour
cond.assignedClearUI = ui; cond.assignedClearUI = ui;
} }
} }
public void ResetAllClearUIs()
{
for (int i = 0; i < uiList.Count;)
{
Destroy(uiList[i]);
uiList.RemoveAt(i);
}
nexty = -100;
}
} }
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