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

버그 수정함

parent 3abc3364
...@@ -27,14 +27,13 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto ...@@ -27,14 +27,13 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
public void Interact(Vector2Int pos) public void Interact(Vector2Int pos)
{ {
if(!GameManager.inst.isGameOver) if(!GameManager.inst.isGameOver && PlayerController.inst.currentPlayer != null)
{ {
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; GameManager.inst.isGameOver = true;
StartCoroutine(GameManager.inst.RestartStage()); StartCoroutine(GameManager.inst.RestartStage());
GameManager.inst.uiGenerator.ResetAllClearUIs(); GameManager.inst.uiGenerator.ResetAllClearUIs();
//TODO : Restart Level //TODO : Restart Level
} }
} }
......
...@@ -70,18 +70,15 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor ...@@ -70,18 +70,15 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
transform.Rotate(new Vector3(0, Random.Range(0, 4) * 90, 0)); transform.Rotate(new Vector3(0, Random.Range(0, 4) * 90, 0));
isWhite = true; isWhite = true;
Color = Color.white; Color = Color.white;
if (GameManager.white >= 0) MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(1); //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.black >= 0 && !isWhite) if (GameManager.black >= 0 && !isWhite) MapManager.inst.currentMap.clearConditions[GameManager.black].count++;
{ if (GameManager.white >= 0 && isWhite) MapManager.inst.currentMap.clearConditions[GameManager.white].count++;
MapManager.inst.currentMap.clearConditions[GameManager.black].count++;
if (GameManager.white >= 0) MapManager.inst.currentMap.clearConditions[GameManager.white].count--;
}
} }
#region IObject Override #region IObject Override
......
...@@ -90,15 +90,13 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -90,15 +90,13 @@ public class MapManager : SingletonBehaviour<MapManager>
if (!child.GetComponent<Mannequin>().isWhite && GameManager.black >= 0) if (!child.GetComponent<Mannequin>().isWhite && GameManager.black >= 0)
currentMap.clearConditions[GameManager.black].IsDone(1); currentMap.clearConditions[GameManager.black].IsDone(1);
} }
} }
for (int i = 0; i < currentMap.startFloors.Count; i++) for (int i = 0; i < currentMap.startFloors.Count; i++)
PlayerController.inst.CreatePlayer(currentMap.startFloors[i]); PlayerController.inst.CreatePlayer(currentMap.startFloors[i]);
for (int i = 0; i < loadedMapData.bullets.Count; i++) for (int i = 0; i < loadedMapData.bullets.Count; i++)
PlayerController.inst.AddBullet(loadedMapData.bullets[i]); PlayerController.inst.AddBullet(loadedMapData.bullets[i]);
} }
public IEnumerator Rebaker() public IEnumerator Rebaker()
{ {
yield return null; yield return null;
......
...@@ -25,14 +25,15 @@ public class ClearCondition ...@@ -25,14 +25,15 @@ public class ClearCondition
count += _count; count += _count;
goal += _goal; goal += _goal;
assignedClearUI.RefreshClearCondition(); assignedClearUI.RefreshClearCondition();
if (goal <= count && !isDone) if ((type == ClearType.White || type == ClearType.Black) ? goal == count : goal <= count && !isDone)
{ {
GameManager.inst.clearCounter--; GameManager.inst.clearCounter--;
isDone = true; isDone = true;
Debug.Log(GameManager.inst.clearCounter);
if (GameManager.inst.clearCounter == 0) if (GameManager.inst.clearCounter == 0)
GameManager.inst.StartCoroutine(GameManager.inst.ClearStage()); GameManager.inst.StartCoroutine(GameManager.inst.ClearStage());
} }
else if (goal > count) else if ((type == ClearType.White || type == ClearType.Black) ? goal != count : goal > count && isDone)
{ {
GameManager.inst.clearCounter++; GameManager.inst.clearCounter++;
isDone = false; isDone = false;
......
...@@ -265,9 +265,9 @@ public class Map : MonoBehaviour ...@@ -265,9 +265,9 @@ public class Map : MonoBehaviour
else if(objectGrid[pos].GetType() == ObjType.Mannequin) else if(objectGrid[pos].GetType() == ObjType.Mannequin)
{ {
if(objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.white >= 0) if(objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.white >= 0)
clearConditions[GameManager.white].IsDone(0, -1); clearConditions[GameManager.white].IsDone(-1);
else if (!objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.black >= 0) else if (!objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.black >= 0)
clearConditions[GameManager.black].IsDone(0, -1); clearConditions[GameManager.black].IsDone(-1);
} }
if(objectGrid[pos].GetType() != ObjType.Mannequin) if(objectGrid[pos].GetType() != ObjType.Mannequin)
PlayerController.inst.OnPlayerMove -= objectGrid[pos].GetObject().GetComponent<IPlayerInteractor>().Interact; PlayerController.inst.OnPlayerMove -= objectGrid[pos].GetObject().GetComponent<IPlayerInteractor>().Interact;
......
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