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:
count: 0
goal: 0
isDone: 0
assignedClearUI: {fileID: 0}
emptyBox: {fileID: 21300000, guid: 66bb74902851e6f45b1dd366762222ac, type: 3}
fullBox: {fileID: 21300000, guid: 05626d4bcfb37c74c927e1ee78806026, type: 3}
tooltipText: {fileID: 361559068607976195}
slashText: {fileID: 6462260514077688296}
goalText: {fileID: 6816787038235562072}
statusText: {fileID: 8133949305956932585}
doneImage: {fileID: 6431706617031002862}
......
......@@ -22,7 +22,11 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
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;
floor.objOnFloor = this;
PlayerController.inst.OnPlayerMove += Interact;
......@@ -58,12 +62,10 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
{
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);
MapManager.inst.currentMap.RemoveObject(Position);
}
}
......
......@@ -18,10 +18,6 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
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);
}
......
......@@ -77,8 +77,8 @@ public class Mannequin : MonoBehaviour, IObject, IBulletInteractor
{
Color = isWhite ? Color.white : Color.black;
this.isWhite = 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++;
if (GameManager.black >= 0 && !isWhite) MapManager.inst.currentMap.clearConditions[GameManager.black].IsDone(1);
else if (GameManager.white >= 0 && isWhite) MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(1);
}
#region IObject Override
......
......@@ -36,6 +36,13 @@ public class MapManager : SingletonBehaviour<MapManager>
PlayerController.inst.bulletList.Clear();
players.Clear();
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;
for(int i = 1; i < loadedMapData.objects.Count; i++)
{
......@@ -74,24 +81,7 @@ public class MapManager : SingletonBehaviour<MapManager>
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();
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++)
PlayerController.inst.CreatePlayer(currentMap.startFloors[i]);
for (int i = 0; i < loadedMapData.bullets.Count; i++)
......
......@@ -24,20 +24,20 @@ public class ClearCondition
{
count += _count;
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--;
isDone = true;
Debug.Log(GameManager.inst.clearCounter);
//Debug.Log(GameManager.inst.clearCounter);
if (GameManager.inst.clearCounter == 0)
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++;
isDone = false;
}
assignedClearUI.RefreshClearCondition();
}
}
}
......@@ -255,23 +255,34 @@ public class Map : MonoBehaviour
/// Remove Object at position.
/// </summary>
/// <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[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);
else if(objectGrid[pos].GetType() == ObjType.Mannequin)
switch(objectGrid[pos].GetType())
{
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);
case ObjType.Camera:
if (GameManager.aTurret >= 0)
clearConditions[GameManager.aTurret].IsDone(0, -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());
objectGrid.Remove(pos);
floorGrid[pos].objOnFloor = null;
......
......@@ -11,6 +11,7 @@ public class ClearStatusUI : MonoBehaviour
public Sprite fullBox;
[Header("inside")]
public Text tooltipText;
public Text slashText;
public Text goalText;
public Text statusText;
public Image doneImage;
......@@ -19,16 +20,34 @@ public class ClearStatusUI : MonoBehaviour
{
assignedCondition = condition;
tooltipText.text = tooltip;
goalText.text = assignedCondition.goal.ToString();
statusText.text = assignedCondition.count.ToString();
if (condition.type == ClearType.AllCase || condition.type == ClearType.AllFloor || condition.type == ClearType.AllTurret)
{
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;
else doneImage.sprite = emptyBox;
}
public void RefreshClearCondition()
{
goalText.text = assignedCondition.goal.ToString();
statusText.text = assignedCondition.count.ToString();
if (assignedCondition.type == ClearType.AllCase || assignedCondition.type == ClearType.AllFloor || assignedCondition.type == ClearType.AllTurret)
{
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;
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