// Update is called once per frame void Update() { if (gameManager.isRoundProgressing) { cam.orthographicSize = zoomSlider.value; EventSystem.current.GetComponent <EventSystem>().SetSelectedGameObject(null); MoveCamera(); if (gameManager.currentGamePhase == GameManager.GamePhase.TilePlacement) { Ray ray = cam.ScreenPointToRay(Input.mousePosition); Vector3 worldPoint = ray.GetPoint(-ray.origin.z / ray.origin.z); Vector3Int position = currentGrid.WorldToCell(worldPoint); position.z = 0; if (Input.GetMouseButtonDown(0)) { if (currentTileMap.GetTile(position) != null && currentTileMap.GetTile(position).name == "NESW-x") { if (playerIcon.GetComponent <PartyBehaviour>().currentTile.name == "NESW-x") { gameManager.ProceedToNextGamePhase(); StartCoroutine(playerIcon.GetComponent <PartyBehaviour>().MoveParty(null)); } else { Vector3 nextPos = currentGrid.GetCellCenterWorld(position); nextPos.x += 0.0f; nextPos.y += 0.5f; nextPos.z = 0; boardManager.aStarGrid.SetVariables(nextPos); boardManager.Pathfinding(playerIcon.transform.position, nextPos); List <Vector3> path = new List <Vector3>(); foreach (Node n in boardManager.aStarGrid.path) { path.Add(n.worldPosition); } gameManager.ProceedToNextGamePhase(); StartCoroutine(playerIcon.GetComponent <PartyBehaviour>().MoveParty(path.ToArray())); } } else { PlaceTilesInWorldSpace(position, currentGrid, currentTileMap); } } previewSprite.gameObject.transform.position = cam.ScreenToWorldPoint(Input.mousePosition); if (tile != null) { switch (CanBePlaced(tile, position)) { case true: previewSprite.color = canPlace; break; case false: previewSprite.color = cannotPlace; break; } } } } }