Commit e74d4b08 authored by 18신대성's avatar 18신대성 Committed by 18손재민

잡다한 오류들 싸그리 수정

(특히 all 관련 clearcond들)
parent 487461c5
This diff is collapsed.
fileFormatVersion: 2
guid: 3d35fd3e6a494bc42921ce1cd03fc637
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: dbb2e09c19fe5ad49b11a6b95e5ac9e8
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -255,9 +255,11 @@ MonoBehaviour: ...@@ -255,9 +255,11 @@ MonoBehaviour:
count: 0 count: 0
goal: 0 goal: 0
isDone: 0 isDone: 0
assignedClearUI: {fileID: 0}
emptyBox: {fileID: 21300000, guid: 66bb74902851e6f45b1dd366762222ac, type: 3} emptyBox: {fileID: 21300000, guid: 66bb74902851e6f45b1dd366762222ac, type: 3}
fullBox: {fileID: 21300000, guid: 05626d4bcfb37c74c927e1ee78806026, type: 3} fullBox: {fileID: 21300000, guid: 05626d4bcfb37c74c927e1ee78806026, type: 3}
tooltipText: {fileID: 361559068607976195} tooltipText: {fileID: 361559068607976195}
slashText: {fileID: 6462260514077688296}
goalText: {fileID: 6816787038235562072} goalText: {fileID: 6816787038235562072}
statusText: {fileID: 8133949305956932585} statusText: {fileID: 8133949305956932585}
doneImage: {fileID: 6431706617031002862} doneImage: {fileID: 6431706617031002862}
......
...@@ -22,7 +22,11 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor ...@@ -22,7 +22,11 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
public void Init(Floor floor) public void Init(Floor floor)
{ {
if (GameManager.aCase >= 0) MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(0, 1); if (GameManager.aCase >= 0)
{
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(0, 1);
Debug.Log("init brief");
}
this.floor = floor; this.floor = floor;
floor.objOnFloor = this; floor.objOnFloor = this;
PlayerController.inst.OnPlayerMove += Interact; PlayerController.inst.OnPlayerMove += Interact;
...@@ -58,12 +62,10 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor ...@@ -58,12 +62,10 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
{ {
if (dropBullet != BulletCode.None) if (dropBullet != BulletCode.None)
PlayerController.inst.AddBullet(dropBullet); PlayerController.inst.AddBullet(dropBullet);
if (GameManager.aCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(1);
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, true); MapManager.inst.currentMap.RemoveObject(Position);
} }
} }
......
...@@ -18,10 +18,6 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto ...@@ -18,10 +18,6 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
public void Break() public void Break()
{ {
if (GameManager.aTurret >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aTurret].IsDone(1);
if (GameManager.nTurret >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.nTurret].IsDone(1);
MapManager.inst.currentMap.RemoveObject(Position); MapManager.inst.currentMap.RemoveObject(Position);
} }
......
...@@ -77,8 +77,8 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor ...@@ -77,8 +77,8 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
{ {
Color = isWhite ? Color.white : Color.black; Color = isWhite ? Color.white : Color.black;
this.isWhite = isWhite; this.isWhite = isWhite;
if (GameManager.black >= 0 && !isWhite) MapManager.inst.currentMap.clearConditions[GameManager.black].count++; if (GameManager.black >= 0 && !isWhite) MapManager.inst.currentMap.clearConditions[GameManager.black].IsDone(1);
if (GameManager.white >= 0 && isWhite) MapManager.inst.currentMap.clearConditions[GameManager.white].count++; else if (GameManager.white >= 0 && isWhite) MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(1);
} }
#region IObject Override #region IObject Override
......
...@@ -36,6 +36,13 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -36,6 +36,13 @@ public class MapManager : SingletonBehaviour<MapManager>
PlayerController.inst.bulletList.Clear(); PlayerController.inst.bulletList.Clear();
players.Clear(); players.Clear();
currentMap.maxMapSize = (int)loadedMapData.objects[0].xPos; currentMap.maxMapSize = (int)loadedMapData.objects[0].xPos;
for (int i = 0; i < loadedMapData.clears.Count; i++)
{
var temp = loadedMapData.clears[i];
currentMap.clearConditions.Add(new ClearCondition(temp.type, temp.goal));
}
GameManager.inst.SetClearIndex(currentMap);
GameManager.inst.uiGenerator.GenerateAllClearUI();
int casesIndex = 0; int casesIndex = 0;
for(int i = 1; i < loadedMapData.objects.Count; i++) for(int i = 1; i < loadedMapData.objects.Count; i++)
{ {
...@@ -74,24 +81,7 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -74,24 +81,7 @@ public class MapManager : SingletonBehaviour<MapManager>
break; break;
} }
} }
for (int i = 0; i < loadedMapData.clears.Count; i++)
{
var temp = loadedMapData.clears[i];
currentMap.clearConditions.Add(new ClearCondition(temp.type, temp.goal));
}
GameManager.inst.SetClearIndex(currentMap);
surface.BuildNavMesh(); surface.BuildNavMesh();
GameManager.inst.uiGenerator.GenerateAllClearUI();
foreach(Transform child in currentMap.objects.transform)
{
if (child.GetComponent<IObject>() is Mannequin)
{
if(child.GetComponent<Mannequin>().isWhite && GameManager.white >= 0)
currentMap.clearConditions[GameManager.white].IsDone(1);
if (!child.GetComponent<Mannequin>().isWhite && GameManager.black >= 0)
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++)
......
...@@ -24,20 +24,20 @@ public class ClearCondition ...@@ -24,20 +24,20 @@ public class ClearCondition
{ {
count += _count; count += _count;
goal += _goal; goal += _goal;
assignedClearUI.RefreshClearCondition(); if (((type == ClearType.White || type == ClearType.Black) ? goal == count : 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); //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 ((type == ClearType.White || type == ClearType.Black) ? goal != count : goal > count && isDone) else if (((type == ClearType.White || type == ClearType.Black) ? goal != count : goal > count) && isDone)
{ {
GameManager.inst.clearCounter++; GameManager.inst.clearCounter++;
isDone = false; isDone = false;
} }
assignedClearUI.RefreshClearCondition();
} }
} }
} }
...@@ -255,23 +255,34 @@ public class Map : MonoBehaviour ...@@ -255,23 +255,34 @@ 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, bool isCaseInteracted = false) public void RemoveObject(Vector2Int pos)
{ {
if (objectGrid.ContainsKey(pos)) if (objectGrid.ContainsKey(pos))
{ {
if(objectGrid[pos].GetType() == ObjType.Briefcase && GameManager.aCase >= 0 && !isCaseInteracted) switch(objectGrid[pos].GetType())
clearConditions[GameManager.aCase].IsDone(0, -1);
else if (objectGrid[pos].GetType() == ObjType.Camera && GameManager.aTurret >= 0)
clearConditions[GameManager.aTurret].IsDone(0, -1);
else if(objectGrid[pos].GetType() == ObjType.Mannequin)
{ {
if(objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.white >= 0) case ObjType.Camera:
clearConditions[GameManager.white].IsDone(-1); if (GameManager.aTurret >= 0)
else if (!objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.black >= 0) clearConditions[GameManager.aTurret].IsDone(0, -1);
clearConditions[GameManager.black].IsDone(-1); if (GameManager.nTurret >= 0)
clearConditions[GameManager.nTurret].IsDone(1);
PlayerController.inst.OnPlayerMove -= objectGrid[pos].GetObject().GetComponent<IPlayerInteractor>().Interact;
break;
case ObjType.Mannequin:
if (objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.white >= 0)
clearConditions[GameManager.white].IsDone(-1);
else if (!objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.black >= 0)
clearConditions[GameManager.black].IsDone(-1);
break;
case ObjType.Briefcase:
if (GameManager.aCase >= 0)
clearConditions[GameManager.aCase].IsDone(0, -1);
PlayerController.inst.OnPlayerMove -= objectGrid[pos].GetObject().GetComponent<IPlayerInteractor>().Interact;
break;
default:
Debug.Log("[ERR] 병신아");
break;
} }
if(objectGrid[pos].GetType() != ObjType.Mannequin)
PlayerController.inst.OnPlayerMove -= objectGrid[pos].GetObject().GetComponent<IPlayerInteractor>().Interact;
Destroy(objectGrid[pos].GetObject()); Destroy(objectGrid[pos].GetObject());
objectGrid.Remove(pos); objectGrid.Remove(pos);
floorGrid[pos].objOnFloor = null; floorGrid[pos].objOnFloor = null;
......
...@@ -11,6 +11,7 @@ public class ClearStatusUI : MonoBehaviour ...@@ -11,6 +11,7 @@ public class ClearStatusUI : MonoBehaviour
public Sprite fullBox; public Sprite fullBox;
[Header("inside")] [Header("inside")]
public Text tooltipText; public Text tooltipText;
public Text slashText;
public Text goalText; public Text goalText;
public Text statusText; public Text statusText;
public Image doneImage; public Image doneImage;
...@@ -19,16 +20,34 @@ public class ClearStatusUI : MonoBehaviour ...@@ -19,16 +20,34 @@ public class ClearStatusUI : MonoBehaviour
{ {
assignedCondition = condition; assignedCondition = condition;
tooltipText.text = tooltip; tooltipText.text = tooltip;
goalText.text = assignedCondition.goal.ToString(); if (condition.type == ClearType.AllCase || condition.type == ClearType.AllFloor || condition.type == ClearType.AllTurret)
statusText.text = assignedCondition.count.ToString(); {
goalText.text = "";
statusText.text = "";
slashText.text = (assignedCondition.goal - assignedCondition.count).ToString();
}
else
{
goalText.text = assignedCondition.goal.ToString();
statusText.text = assignedCondition.count.ToString();
}
if (assignedCondition.isDone) doneImage.sprite = fullBox; if (assignedCondition.isDone) doneImage.sprite = fullBox;
else doneImage.sprite = emptyBox; else doneImage.sprite = emptyBox;
} }
public void RefreshClearCondition() public void RefreshClearCondition()
{ {
goalText.text = assignedCondition.goal.ToString(); if (assignedCondition.type == ClearType.AllCase || assignedCondition.type == ClearType.AllFloor || assignedCondition.type == ClearType.AllTurret)
statusText.text = assignedCondition.count.ToString(); {
goalText.text = "";
statusText.text = "";
slashText.text = (assignedCondition.goal - assignedCondition.count).ToString();
}
else
{
goalText.text = assignedCondition.goal.ToString();
statusText.text = assignedCondition.count.ToString();
}
if (assignedCondition.isDone) doneImage.sprite = fullBox; if (assignedCondition.isDone) doneImage.sprite = fullBox;
else doneImage.sprite = emptyBox; else doneImage.sprite = emptyBox;
} }
......
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