Commit 2ac1f652 authored by 18손재민's avatar 18손재민

Merge branch 'map'

parents d4320995 1954058a
......@@ -89,7 +89,6 @@ GameObject:
- component: {fileID: 2534561534465045041}
- component: {fileID: 2534561534464242193}
- component: {fileID: 2534561534463275217}
- component: {fileID: -2850530927027858165}
- component: {fileID: -4559840392902712278}
- component: {fileID: -954323813722370706}
m_Layer: 13
......@@ -162,19 +161,6 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 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
MonoBehaviour:
m_ObjectHideFlags: 0
......
......@@ -422,6 +422,85 @@ MonoBehaviour:
m_VerticalOverflow: 0
m_LineSpacing: 1
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
GameObject:
m_ObjectHideFlags: 0
......@@ -961,6 +1040,7 @@ RectTransform:
- {fileID: 1444571407224148019}
- {fileID: 1444571408487427164}
- {fileID: 1466596363}
- {fileID: 1854540598}
m_Father: {fileID: 1444571408780882984}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -1508,6 +1588,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
currentBullet: {fileID: 3656934010764012818}
clear: {fileID: 1854540599}
xInput: {fileID: 1444571407224148016}
yInput: {fileID: 1444571408487427165}
--- !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]}
\ No newline at end of file
{"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
{"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
{"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
fileFormatVersion: 2
guid: b65159d8e62109d4990676399736ddbf
guid: a0bbdbca5d3d3904b8af6f4f7266190d
TextScriptImporter:
externalObjects: {}
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:
m_Name:
m_EditorClassIdentifier:
clearUI: {fileID: 4890012631615838995, guid: 874af447cef689e478ca96b4d1d197c2, type: 3}
uiList: []
--- !u!114 &158856769
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -305,7 +306,7 @@ Light:
m_BounceIntensity: 1
m_ColorTemperature: 6570
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_ShadowRadius: 0
m_ShadowAngle: 0
......
......@@ -51,18 +51,22 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
public void Interact(Vector2Int position)
{
Debug.Log(Position + " " + position);
if (Position == position)
if(!GameManager.inst.isGameOver)
{
if (dropBullet != BulletCode.None)
PlayerController.inst.AddBullet(dropBullet);
if (GameManager.aCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(1);
if (GameManager.nCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.nCase].IsDone(1);
floor.objOnFloor = null;
MapManager.inst.currentMap.RemoveObject(Position);
}
Debug.Log(Position + " " + position);
if (Position == position)
{
if (dropBullet != BulletCode.None)
PlayerController.inst.AddBullet(dropBullet);
if (GameManager.aCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(1);
if (GameManager.nCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.nCase].IsDone(1);
floor.objOnFloor = null;
MapManager.inst.currentMap.RemoveObject(Position, true);
}
}
}
ObjType IObject.GetType()
......
......@@ -13,7 +13,8 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
this.floor = floor;
floor.objOnFloor = this;
PlayerController.inst.OnPlayerMove += Interact;
}
if (GameManager.aTurret >= 0) MapManager.inst.currentMap.clearConditions[GameManager.aTurret].IsDone(0, 1);
}
public void Break()
{
......@@ -26,11 +27,16 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
public void Interact(Vector2Int pos)
{
if (Position.IsInAdjacentArea(pos, 1) && MapManager.inst.currentMap.GetWallAtPos((Vector2)(Position + pos) / 2) == null)
{
StartCoroutine(GameManager.inst.RestartStage());
//TODO : Restart Level
if(!GameManager.inst.isGameOver)
{
if (Position.IsInAdjacentArea(pos, 1) && MapManager.inst.currentMap.GetWallAtPos((Vector2)(Position + pos) / 2) == null)
{
GameManager.inst.isGameOver = true;
StartCoroutine(GameManager.inst.RestartStage());
GameManager.inst.uiGenerator.ResetAllClearUIs();
//TODO : Restart Level
}
}
}
......
......@@ -68,16 +68,17 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
this.floor = floor;
floor.objOnFloor = this;
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)
{
Color = isWhite ? Color.white : Color.black;
this.isWhite = isWhite;
if (GameManager.white >= 0 && isWhite)
MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(1);
if (GameManager.black >= 0 && !isWhite)
MapManager.inst.currentMap.clearConditions[GameManager.black].IsDone(1);
if (GameManager.white >= 0 && isWhite) MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(1);
if (GameManager.black >= 0 && !isWhite) MapManager.inst.currentMap.clearConditions[GameManager.black].IsDone(1);
}
#region IObject Override
......
......@@ -6,6 +6,7 @@ using UnityEngine.SceneManagement;
public class GameManager : SingletonBehaviour<GameManager>
{
public ClearUIGenerator uiGenerator;
public bool isGameOver = false;
public int[] clearIndex = new int[9];
public int clearCounter = 0;
......@@ -47,39 +48,43 @@ public class GameManager : SingletonBehaviour<GameManager>
MapManager.inst.LoadMap(currentStage);
}
public void ClearStage()
public IEnumerator ClearStage()
{
GameObject.Find("TestTools").GetComponent<TestTools>().clear.gameObject.SetActive(true);
Debug.Log("Stage Clear!");
yield return new WaitForSeconds(3);
BackToStageSelect();
}
public void GameOver()
{
Debug.Log("Game Over!");
StopAllCoroutines();
foreach (GameObject child in MapManager.inst.players)
Destroy(child);
Destroy(MapManager.inst.currentMap.gameObject);
}
public IEnumerator RestartStage()
{
Debug.Log("Game Restart!");
yield return new WaitForSeconds(0.5f);
GameOver();
StartStage();
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
public void BackToStageSelect()
{
GameOver();
Destroy(FindObjectOfType<StageSelector>().gameObject);
SceneManager.LoadScene("SelectStage");
}
// Start is called before the first frame update
void Start()
{
currentStage = Resources.Load<TextAsset>("Stages/" + "stage" + (StageSelector.selectedStage + 1));
StartStage();
Destroy(FindObjectOfType<StageSelector>().gameObject);
if (!MapManager.inst.isMapEditingOn)
{
isGameOver = false;
currentStage = Resources.Load<TextAsset>("Stages/" + "stage" + (StageSelector.selectedStage + 1));
StartStage();
//Destroy(FindObjectOfType<StageSelector>().gameObject);
}
}
}
......@@ -2,7 +2,6 @@
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class ClearCondition
{
......@@ -32,7 +31,7 @@ public class ClearCondition
Debug.Log(GameManager.inst.clearCounter);
assignedClearUI.RefreshClearCondition();
if (GameManager.inst.clearCounter == 0)
GameManager.inst.ClearStage();
GameManager.inst.StartCoroutine(GameManager.inst.ClearStage());
}
else if (goal > count && isDone)
{
......
......@@ -223,13 +223,9 @@ public class Map : MonoBehaviour
{
case ObjType.Briefcase:
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;
case ObjType.Camera:
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;
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>());
......@@ -251,11 +247,11 @@ public class Map : MonoBehaviour
/// Remove Object at position.
/// </summary>
/// <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[pos].GetType() == ObjType.Briefcase && GameManager.aCase >= 0)
if(objectGrid[pos].GetType() == ObjType.Briefcase && GameManager.aCase >= 0 && !isCaseInteracted)
clearConditions[GameManager.aCase].IsDone(0, -1);
else if (objectGrid[pos].GetType() == ObjType.Camera && GameManager.aTurret >= 0)
clearConditions[GameManager.aTurret].IsDone(0, -1);
......
......@@ -72,6 +72,9 @@ public class MapEditor : SingletonBehaviour<MapEditor>
/// <param name="_newMap"></param>
public void SaveMap(Map _newMap)
{
/* 맵 저장 시 반드시 승리 조건 작성할 것
* 목표가 '모든'일 경우 승리 목표는 초기 맵 기준으로 작성
*/
System.DateTime time = System.DateTime.Now;
string localPath = "Assets/" + time.ToShortDateString() + "-" + time.Hour + "-" + time.Minute + "-" + time.Second + ".json";
if(currentMap.startFloors.Count == 0)
......
......@@ -112,14 +112,6 @@ public class Player : MonoBehaviour
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
void Start()
{
......
......@@ -133,57 +133,60 @@ public class PlayerController : SingletonBehaviour<PlayerController>
// Update is called once per frame
void Update()
{
if (prePos != MapPos)
if(!GameManager.inst.isGameOver)
{
//Debug.Log(MapPos);
OnPlayerMove?.Invoke(MapPos);
prePos = MapPos;
}
if (prePos != MapPos)
{
//Debug.Log(MapPos);
OnPlayerMove?.Invoke(MapPos);
prePos = MapPos;
}
//Control player only if camera is not zooming in to or out from the current player
if (!isZooming)
{
if (Input.GetMouseButtonDown(0))
//Control player only if camera is not zooming in to or out from the current player
if (!isZooming)
{
//Move the current player.
if(!isPlayerMoving && !isPlayerShooting)
if (Input.GetMouseButtonDown(0))
{
Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(mouseRay, out hit) && hit.collider.gameObject.tag.Equals("Player"))
{
if (currentPlayer != null)
currentPlayer.ResetCurrentPlayer();
currentPlayer = hit.transform.gameObject.GetComponent<Player>();
StartCoroutine(currentPlayer.SetCurrentPlayer());
StartCoroutine(currentPlayer.CountPlayerClick(Time.time));
//Debug.Log(hit.collider.gameObject.tag);
}
else if (Physics.Raycast(mouseRay, out hit) && hit.collider.gameObject.tag.Equals("floor"))
//Move the current player.
if (!isPlayerMoving && !isPlayerShooting)
{
if (currentPlayer != null)
currentPlayer.MovePlayer(hit.collider.gameObject.transform.position);
//Debug.Log(hit.collider.gameObject.tag);
Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(mouseRay, out hit) && hit.collider.gameObject.tag.Equals("Player"))
{
if (currentPlayer != null)
currentPlayer.ResetCurrentPlayer();
currentPlayer = hit.transform.gameObject.GetComponent<Player>();
StartCoroutine(currentPlayer.SetCurrentPlayer());
StartCoroutine(currentPlayer.CountPlayerClick(Time.time));
//Debug.Log(hit.collider.gameObject.tag);
}
else if (Physics.Raycast(mouseRay, out hit) && hit.collider.gameObject.tag.Equals("floor"))
{
if (currentPlayer != null)
currentPlayer.MovePlayer(hit.collider.gameObject.transform.position);
//Debug.Log(hit.collider.gameObject.tag);
}
else if (hit.collider == null)
{
if (currentPlayer != null)
currentPlayer.ResetCurrentPlayer();
}
}
else if (hit.collider == null)
else if (isPlayerShooting)
{
if (currentPlayer != null)
currentPlayer.ResetCurrentPlayer();
if (bulletList.Count > 0)
{
currentPlayer.Shoot(bulletList[0]);
}
}
}
else if (isPlayerShooting)
else if (Input.GetMouseButtonDown(1) && isPlayerShooting)
{
if (bulletList.Count > 0)
{
currentPlayer.Shoot(bulletList[0]);
}
StartCoroutine(Camera.main.GetComponent<CameraController>().ZoomOutFromPlayer(currentPlayer));
currentPlayer.shootingArm.rotation = currentPlayer.armRotation;
}
}
else if (Input.GetMouseButtonDown(1) && isPlayerShooting)
{
StartCoroutine(Camera.main.GetComponent<CameraController>().ZoomOutFromPlayer(currentPlayer));
currentPlayer.shootingArm.rotation = currentPlayer.armRotation;
}
}
}
......
......@@ -20,6 +20,7 @@ public class StageSelector : MonoBehaviour
public void StartSelectedStage()
{
gameObject.GetComponent<Canvas>().enabled = false;
SceneManager.LoadScene("PlayStage");
}
......
......@@ -5,7 +5,7 @@ using UnityEngine.UI;
public class TestTools : MonoBehaviour
{
public Text currentBullet;
public Text currentBullet, clear;
public InputField xInput, yInput;
public void AddFloor()
......
......@@ -5,6 +5,7 @@ using UnityEngine;
public class ClearUIGenerator : MonoBehaviour
{
public GameObject clearUI;
public List<GameObject> uiList;
private int nextx = -175;
private int nexty = -100;
......@@ -14,7 +15,9 @@ public class ClearUIGenerator : MonoBehaviour
{
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);
nexty -= 200;
......@@ -57,4 +60,14 @@ public class ClearUIGenerator : MonoBehaviour
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