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

드디어 신대성 거울에게 승리

floor에도 플레이어 정보와 오브젝트 정보를 넣음
모든 오브젝트 init시 floor에 정보 들어가게
parent 79f1cca0
......@@ -35,6 +35,7 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(1);
if (GameManager.nCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.nCase].IsDone(1);
floor.objOnFloor = null;
Destroy(gameObject);
}
}
......
......@@ -10,6 +10,7 @@ public class Floor : MonoBehaviour
public Vector2Int mapPos;
public bool isGoalFloor = false;
public IObject objOnFloor = null;
public bool isPlayerOn = false;
// Start is called before the first frame update
void Start()
......
This diff is collapsed.
......@@ -72,7 +72,9 @@ 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);
currentFloor.isPlayerOn = false;
currentFloor = MapManager.inst.currentMap.GetFloorAtPos(new Vector2Int((int)destination.x, (int)destination.z));
currentFloor.isPlayerOn = true;
PlayerController.inst.CheckCurrentFloors();
anim.SetBool("isWalking", false);
PlayerController.inst.isPlayerMoving = false;
......
......@@ -39,6 +39,7 @@ public class PlayerController : SingletonBehaviour<PlayerController>
}
GameObject player = Instantiate(MapManager.inst.player, floor.transform.position + new Vector3(0, 0.1f, 0), Quaternion.identity);
player.GetComponent<Player>().currentFloor = floor;
floor.isPlayerOn = true;
MapManager.inst.players.Add(player);
if (GameManager.nPlayer >= 0)
{
......@@ -68,6 +69,7 @@ public class PlayerController : SingletonBehaviour<PlayerController>
{
if (obj.GetComponent<Player>().currentFloor == floor)
{
floor.isPlayerOn = false;
MapManager.inst.players.Remove(obj);
if (GameManager.nPlayer >= 0)
{
......
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