Commit 759643e8 authored by 18손재민's avatar 18손재민

마네킹 및 터렛 제외한 모든 승리조건 넣음

parent 88e50fd3
...@@ -381,7 +381,7 @@ MonoBehaviour: ...@@ -381,7 +381,7 @@ MonoBehaviour:
clearConditions: clearConditions:
- type: 0 - type: 0
count: 0 count: 0
goal: 4 goal: 3
- type: 3 - type: 3
count: 0 count: 0
goal: 3 goal: 3
......
...@@ -31,9 +31,15 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor ...@@ -31,9 +31,15 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
if (Position == position) if (Position == position)
{ {
if (GameManager.aCase >= 0) if (GameManager.aCase >= 0)
{
MapManager.inst.currentMap.clearConditions[GameManager.aCase].count++;
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(); MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone();
}
if (GameManager.nCase >= 0) if (GameManager.nCase >= 0)
{
MapManager.inst.currentMap.clearConditions[GameManager.nCase].count++;
MapManager.inst.currentMap.clearConditions[GameManager.nCase].IsDone(); MapManager.inst.currentMap.clearConditions[GameManager.nCase].IsDone();
}
Destroy(gameObject); Destroy(gameObject);
} }
} }
......
...@@ -34,7 +34,6 @@ public class ClearCondition ...@@ -34,7 +34,6 @@ public class ClearCondition
{ {
if (!isDone) if (!isDone)
{ {
count++;
if (goal <= count) if (goal <= count)
{ {
GameManager.inst.clearCounter--; GameManager.inst.clearCounter--;
......
...@@ -60,6 +60,8 @@ public class Map : MonoBehaviour ...@@ -60,6 +60,8 @@ public class Map : MonoBehaviour
floorGrid.Add(pos, Instantiate(MapManager.inst.floor, new Vector3(pos.x, 0, pos.y), Quaternion.identity, floors.transform).GetComponent<Floor>()); floorGrid.Add(pos, Instantiate(MapManager.inst.floor, new Vector3(pos.x, 0, pos.y), Quaternion.identity, floors.transform).GetComponent<Floor>());
floorGrid[pos].mapPos = pos; floorGrid[pos].mapPos = pos;
floorGrid[pos].isPassed = false; floorGrid[pos].isPassed = false;
if (GameManager.aFloor >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aFloor].goal++;
StartCoroutine(MapManager.inst.Rebaker()); StartCoroutine(MapManager.inst.Rebaker());
} }
else else
......
...@@ -29,7 +29,7 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -29,7 +29,7 @@ public class MapManager : SingletonBehaviour<MapManager>
surface.BuildNavMesh(); surface.BuildNavMesh();
GameManager.inst.SetClearIndex(currentMap); GameManager.inst.SetClearIndex(currentMap);
for (int i = 0; i < currentMap.startFloors.Count; i++) for (int i = 0; i < currentMap.startFloors.Count; i++)
PlayerController.inst.CreatePlayer(currentMap.startFloors[i].transform.position); PlayerController.inst.CreatePlayer(currentMap.startFloors[i]);
} }
public IEnumerator Rebaker() public IEnumerator Rebaker()
{ {
......
...@@ -15,6 +15,8 @@ public class Player : MonoBehaviour ...@@ -15,6 +15,8 @@ public class Player : MonoBehaviour
public GameObject shootingArm; public GameObject shootingArm;
Animator anim; Animator anim;
public Floor currentFloor;
/// <summary> /// <summary>
/// Set this player as the current player. /// Set this player as the current player.
/// </summary> /// </summary>
...@@ -68,15 +70,8 @@ public class Player : MonoBehaviour ...@@ -68,15 +70,8 @@ public class Player : MonoBehaviour
while (Mathf.Abs(transform.position.x - destination.x) > 0.01f || Mathf.Abs(transform.position.z - destination.z) > 0.01f) while (Mathf.Abs(transform.position.x - destination.x) > 0.01f || Mathf.Abs(transform.position.z - destination.z) > 0.01f)
yield return null; yield return null;
transform.position = new Vector3(destination.x, transform.position.y, destination.z); transform.position = new Vector3(destination.x, transform.position.y, destination.z);
Floor currentFloor = MapManager.inst.currentMap.GetFloorAtPos(new Vector2Int((int)destination.x, (int)destination.z)); currentFloor = MapManager.inst.currentMap.GetFloorAtPos(new Vector2Int((int)destination.x, (int)destination.z));
if (!currentFloor.isPassed) PlayerController.inst.CheckCurrentFloors();
{
currentFloor.isPassed = true;
if (GameManager.aFloor >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aFloor].IsDone();
if (GameManager.nFloor >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.nFloor].IsDone();
}
anim.SetBool("isWalking", false); anim.SetBool("isWalking", false);
PlayerController.inst.isPlayerMoving = false; PlayerController.inst.isPlayerMoving = false;
} }
......
...@@ -27,14 +27,40 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -27,14 +27,40 @@ public class PlayerController : SingletonBehaviour<PlayerController>
public event Action<Vector2Int> OnPlayerMove; public event Action<Vector2Int> OnPlayerMove;
public void CreatePlayer(Vector3 playerPos) public void CreatePlayer(Floor floor)
{ {
MapManager.inst.players.Add(Instantiate(MapManager.inst.player, playerPos + new Vector3(0, 0.1f, 0), Quaternion.identity)); GameObject player = Instantiate(MapManager.inst.player, floor.transform.position + new Vector3(0, 0.1f, 0), Quaternion.identity);
MapManager.inst.currentMap.clearConditions[GameManager.nPlayer].count = MapManager.inst.players.Count - 1; player.GetComponent<Player>().currentFloor = floor;
Debug.Log(MapManager.inst.players.Count - 1); MapManager.inst.players.Add(player);
if (GameManager.nPlayer >= 0)
{
MapManager.inst.currentMap.clearConditions[GameManager.nPlayer].count = MapManager.inst.players.Count;
MapManager.inst.currentMap.clearConditions[GameManager.nPlayer].IsDone(); MapManager.inst.currentMap.clearConditions[GameManager.nPlayer].IsDone();
} }
CheckCurrentFloors();
}
public void CheckCurrentFloors()
{
int goalFloorCount = 0;
foreach (GameObject child in MapManager.inst.players)
{
Debug.Log("df");
if (child.GetComponent<Player>().currentFloor.isGoalFloor)
goalFloorCount++;
Debug.Log(goalFloorCount);
}
if (GameManager.aFloor >= 0)
{
MapManager.inst.currentMap.clearConditions[GameManager.aFloor].count = goalFloorCount;
MapManager.inst.currentMap.clearConditions[GameManager.aFloor].IsDone();
}
if (GameManager.nFloor >= 0)
{
MapManager.inst.currentMap.clearConditions[GameManager.nFloor].count = goalFloorCount;
MapManager.inst.currentMap.clearConditions[GameManager.nFloor].IsDone();
}
}
//For test //For test
public string GetCurrentBullet() public string GetCurrentBullet()
......
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