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

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

parent 88e50fd3
......@@ -381,7 +381,7 @@ MonoBehaviour:
clearConditions:
- type: 0
count: 0
goal: 4
goal: 3
- type: 3
count: 0
goal: 3
......
......@@ -31,9 +31,15 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
if (Position == position)
{
if (GameManager.aCase >= 0)
{
MapManager.inst.currentMap.clearConditions[GameManager.aCase].count++;
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone();
}
if (GameManager.nCase >= 0)
{
MapManager.inst.currentMap.clearConditions[GameManager.nCase].count++;
MapManager.inst.currentMap.clearConditions[GameManager.nCase].IsDone();
}
Destroy(gameObject);
}
}
......
......@@ -34,7 +34,6 @@ public class ClearCondition
{
if (!isDone)
{
count++;
if (goal <= count)
{
GameManager.inst.clearCounter--;
......
......@@ -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[pos].mapPos = pos;
floorGrid[pos].isPassed = false;
if (GameManager.aFloor >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aFloor].goal++;
StartCoroutine(MapManager.inst.Rebaker());
}
else
......
......@@ -29,7 +29,7 @@ public class MapManager : SingletonBehaviour<MapManager>
surface.BuildNavMesh();
GameManager.inst.SetClearIndex(currentMap);
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()
{
......
......@@ -15,6 +15,8 @@ public class Player : MonoBehaviour
public GameObject shootingArm;
Animator anim;
public Floor currentFloor;
/// <summary>
/// Set this player as the current player.
/// </summary>
......@@ -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)
yield return null;
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));
if (!currentFloor.isPassed)
{
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();
}
currentFloor = MapManager.inst.currentMap.GetFloorAtPos(new Vector2Int((int)destination.x, (int)destination.z));
PlayerController.inst.CheckCurrentFloors();
anim.SetBool("isWalking", false);
PlayerController.inst.isPlayerMoving = false;
}
......
......@@ -27,14 +27,40 @@ public class PlayerController : SingletonBehaviour<PlayerController>
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));
MapManager.inst.currentMap.clearConditions[GameManager.nPlayer].count = MapManager.inst.players.Count - 1;
Debug.Log(MapManager.inst.players.Count - 1);
GameObject player = Instantiate(MapManager.inst.player, floor.transform.position + new Vector3(0, 0.1f, 0), Quaternion.identity);
player.GetComponent<Player>().currentFloor = floor;
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();
}
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
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