void ActivateBigTile(BigTile bigTile, int pos) { bigTile.SetActive(true); bigTile.transform.position = new Vector3(transform.position.x + pos * tileWidth, transform.position.y); if (bigTile.coords == gc.currentMap.coords) { transform.position -= bigTile.transform.position; } }
private void Update() { BigTile activeTile = null; foreach (List <BigTile> column in bigMap) { foreach (BigTile row in column) { if (row != null && row.activeSelf && row.transform.position.x >= -gc.center && row.transform.position.x <= gc.center) { activeTile = row; } } } if (!triggered) { if (activeTile != null) { triggered = true; moving = false; gc.currentMap.SetCoords(activeTile.coords); gc.guiC.ToggleButtons(gc.guiC.exploringArrows, new string[4] { (gc.currentMap.GetTile(notAxis, rot.y) != null && gc.currentMap.GetTile(notAxis, rot.y).type != TileType.none) ? "Up" : null, gc.currentMap.GetTile(notAxis, -rot.y) != null && gc.currentMap.GetTile(notAxis, -rot.y).type != TileType.none ? "Down" : null, gc.currentMap.GetTile(currentAxis, rot.x) != null && gc.currentMap.GetTile(currentAxis, rot.x).type != TileType.none ? "Right" : null, gc.currentMap.GetTile(currentAxis, -rot.x) != null && gc.currentMap.GetTile(currentAxis, -rot.x).type != TileType.none ? "Left" : null } ); transform.position -= activeTile.transform.position; transform.position = new Vector3(transform.position.x, 1); } } else { if (activeTile == null) { triggered = false; } } if (moving) { transform.position += Vector3.left * dir * walkSpeed * Time.deltaTime; } }
private void SetAxis(Axis newAxis) { foreach (Transform child in transform) { child.gameObject.SetActive(false); } triggered = false; currentAxis = newAxis; var x = gc.currentMap.coords.x; var y = gc.currentMap.coords.y; if (currentAxis == Axis.x) { foreach (List <BigTile> column in bigMap) { BigTile bigTile = column[y]; if (bigTile != null) { ActivateBigTile(bigTile, rot.x > 0 ? bigTile.coords.x : gc.currentMap.width - bigTile.coords.x); } } } else { foreach (BigTile bigTile in bigMap[x]) { if (bigTile != null) { ActivateBigTile(bigTile, rot.x > 0 ? bigTile.coords.y : gc.currentMap.height - bigTile.coords.y); } } } gc.guiC.uiDisabled = false; }