void DrawMap() { foreach (RoomInfo room in chambers) { if (room == null) { continue; } Vector2 drawPos = room.gridPosition; RoomAssigner assigner = Instantiate(roomSprites, drawPos, Quaternion.identity, transform).GetComponent <RoomAssigner>(); assigner.type = room.type; assigner.up = room.doorTop; assigner.down = room.doorBot; assigner.left = room.doorLeft; assigner.right = room.doorRight; assignedRooms.Add(assigner); if (assigner.type == 1) { GameObject gameObject = Instantiate(player, assigner.transform.position, Quaternion.identity); RoomMovement roomMovement = gameObject.GetComponent <RoomMovement>(); roomMovement.spawner = this; } else if (assigner.type == 2) { StartCoroutine(SpawnBox(assigner)); } } }
void Start() { //fail = "It does not go there"; coco = GameObject.Find("Player").GetComponent <ItemManager>(); updateRoom = GameObject.Find("RoomManager").GetComponent <RoomMovement>(); }
public void OnTriggerEnter2D(Collider2D collision) { Transform hit = collision.gameObject.transform; lastHit = collision.gameObject; if (collision.CompareTag("Player")) { RoomMovement player = hit.GetComponent <RoomMovement>(); player.SwitchRoom(myCords.ToString()); } }
private void Start() { move = GameObject.Find("RoomManager").gameObject.GetComponent <RoomMovement>(); }