void placeTile() { object[] obj = GameObject.FindObjectsOfType(typeof(TilePrefabScript)); foreach (object o in obj) { TilePrefabScript tilePrefab = (TilePrefabScript)o; Coordinate prefabCoord = tilePrefab.getTileScript().getCoordinates(); TileScript prefabScript = tilePrefab.getTileScript(); if (prefabCoord.getX() == -1 && prefabCoord.getY() == -1) { tilePrefab.setOriginalPos(tilePrefab.transform.position); Vector3 newPos = targetPos [targetPos.Count - 1]; newPos.Set(targetPos [targetPos.Count - 1].x, targetPos [targetPos.Count - 1].y, tilePrefab.originalPosition.z); tilePrefab.transform.position = newPos; tilePrefab.transform.Translate(new Vector3(0, 0, -4), Space.World); prefabScript.setCoordinates(targetCoord [targetCoord.Count - 1]); tilePrefab.setState(Enums.TilePrefabState.Used); moves.Add(prefabScript); } else if (tilePrefab.getState() == Enums.TilePrefabState.Ready) { tilePrefab.setState(Enums.TilePrefabState.Blocked); } } }