public static Rectangle[] GetNodeSourceRects(NodePiece nodePiece) { int x = textureOffsetX; int y = textureOffsetY; Rectangle[] nodeSourceRects = new Rectangle[3]; // locate the "Type" sprite, make it the first entry in the return array. x += PieceWidth + texturePaddingX; y += Array.IndexOf(PieceTypes, nodePiece.Type) * (PieceHeight + texturePaddingY); nodeSourceRects[0] = new Rectangle(x, y, PieceWidth, PieceHeight); // locate the "State" sprite, make it the second entry in the return array. y = textureOffsetY; y += (Array.IndexOf(PieceStates, nodePiece.State) + StateSpriteOffset) * (PieceHeight + texturePaddingY); nodeSourceRects[1] = new Rectangle(x, y, PieceWidth, PieceHeight); // locate the "SecurityRating" sprite, make it the third entry in the return array. x += PieceWidth + texturePaddingX; y = textureOffsetY; y += Array.IndexOf(PieceStates, nodePiece.SecurityRating) * (PieceHeight + texturePaddingY); // WRONG nodeSourceRects[2] = new Rectangle(x, y, PieceWidth, PieceHeight); return nodeSourceRects; }
public void DropPiece() { if (moving == null) { return; } Debug.Log("Dropped"); if (!newIndex.Equals(moving.index)) { game.FlipPieces(moving.index, newIndex, true); } else { game.ResetPiece(moving); } moving = null; }
private void AddExperience(NodePiece nodePiece) { countExperience++; if (countExperience <= 50) { levelExperience = 1; } else { levelExperience = (int)Math.Truncate((double)countExperience / 50); } textAmount.text = levelExperience.ToString(); PlayerPrefs.SetInt("ExpAmount", countExperience); UpdateFillImage(); }
public void DropPiece() { if (_moving == null) { return; } if (!_newIndex.Equals(_moving.index)) { _game.FlipPieces(_moving.index, _newIndex, true); } else { _game.ResetPiece(_moving); } _moving = null; }
void InstantiateBoard() { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int val = board[x, y].value; if (val <= 0) { continue; } GameObject p = Instantiate(nodePiece, gameBoard); NodePiece node = p.GetComponent <NodePiece>(); RectTransform rect = p.GetComponent <RectTransform>(); rect.anchoredPosition = new Vector2(32 + (78 * x), -32 - (80 * y)); node.Initialize(val, new Point(x, y), pieces[val - 1]); } } }
private void AddPiece(NodePiece piece) { if (muchToKill > 0) { if (piece.GetSprite() == taskImage.sprite) { muchToKill--; KilledPiece.text = muchToKill.ToString(); } if (muchToKill <= 0) { muchToKill = 0; Done.gameObject.SetActive(true); KilledPiece.text = ""; EmptyTask(); Match3.AddDeathPiece -= AddPiece; } } }
public void DropPiece() { if (moving == null) { return; } Debug.Log("Dropped"); if (!newIndex.Equals(moving.index)) { // Flip the pieces around on the board game.FlipPieces(moving.index, newIndex, true); } else { // Reset the piece back to original spot game.ResetPiece(moving); } moving = null; }
public TetrisHighScoreData(XElement Source, object PersistenceData) { if (Source.HasElements) { XElement LevelTimeNode = Source.Element("LevelTimes"); XElement PieceCountsNode = Source.Element("PieceCounts"); TotalLines = Source.GetAttributeInt("Lines", 0); if (LevelTimeNode != null) { Dictionary <int, TimeSpan> ConstructListing = new Dictionary <int, TimeSpan>(); foreach (XElement loopelement in LevelTimeNode.Elements("LevelTime")) { int Level = loopelement.GetAttributeInt("Level"); long ticks = loopelement.GetAttributeLong("Time"); if (!ConstructListing.ContainsKey(Level)) { ConstructListing.Add(Level, new TimeSpan(ticks)); } } LevelReachedTimes = (from s in ConstructListing orderby s.Key select s.Value).ToArray(); } else { LevelReachedTimes = new TimeSpan[] { } }; if (PieceCountsNode != null) { TetronimoPieceCounts = new Dictionary <string, int>(); TetronimoLineCounts = new Dictionary <string, int>(); foreach (var NodePiece in PieceCountsNode.Elements("PieceCount")) { String sPiece = NodePiece.GetAttributeString("Piece"); int iCount = NodePiece.GetAttributeInt("Count"); int pieceLines = NodePiece.GetAttributeInt("Lines"); TetronimoPieceCounts.Add(sPiece, iCount); TetronimoLineCounts.Add(sPiece, pieceLines); } } } }
public void dropPiece() { if (moving == null) { return; } Debug.Log("Dropado"); FindObjectOfType <AudioManager>().Play("Swap"); //Audio Queue if (!newIndex.Equals(moving.index)) { game.flipPieces(moving.index, newIndex, true); } else { game.resertPiece(moving); } moving = null; }
void CreateBoard() { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { Node node = GetNodeAtPoint(new Point(x, y)); int val = node.value; if (val <= 0) { continue; } GameObject p = Instantiate(nodePiece, new Vector2(x, y), Quaternion.identity); p.transform.parent = this.transform; NodePiece piece = p.GetComponent <NodePiece>(); piece.Init(val, new Point(x, y), pieces[val - 1]); node.SetPiece(piece); } } }
private void InstantiateBoard() { for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { Node node = GetNodeAtPoint(new Point(x, y)); int value = node.value; if (value <= 0) { continue; } GameObject p = Instantiate(nodePiece, gameBoard); NodePiece piece = p.GetComponent <NodePiece>(); RectTransform rect = p.GetComponent <RectTransform>(); rect.anchoredPosition = new Vector2(-258 + (40 * x), 158 - (40 * y)); piece.Initialize(value, new Point(x, y), pieces[value - 1]); node.SetPiece(piece); } } }
public void ForSkillButton() { if (PlayerData.Instance.currentSP < cost || !game.isCurrentBoardContainDrops(5) || StateManager.Instance.state != StateManager.State.myTurn) { return; } PlayerData.Instance.currentSP -= cost; List <Node> spList = game.getNodesOfValue(5); foreach (Node node in spList) { NodePiece p = node.getPiece(); RectTransform rect = p.GetComponent <RectTransform>(); p.value = value; node.SetPiece(node.getPiece()); game.ForSkillChangePieceSprite(node.index, value); game.CopyBoard(); rect.localScale = Vector3.zero; rect.DOScale(Vector3.one, 0.3f).SetEase(Ease.OutBack); } }
void InstantiateBoard() { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { Node node = getNodeAtPoint(new Point(x, y)); int val = board[x, y].value; if (val <= 0) { continue; } GameObject p = Instantiate(nodePiece, gameBoard); NodePiece piece = p.GetComponent <NodePiece>(); RectTransform rect = p.GetComponent <RectTransform>(); rect.anchoredPosition = new Vector2(50 + (100 * x), -50 - (100 * y)); piece.Initialize(val, new Point(x, y), pieces[val - 1]); node.SetPiece(piece); } } }
void InstantiateBoard() { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { Node node = getNodeAtPoint(new Point(x, y)); int val = node.value; if (val <= 0) { continue; } GameObject p = Instantiate(nodePiece, gameBoard); NodePiece piece = p.GetComponent <NodePiece>(); RectTransform rect = p.GetComponent <RectTransform>(); rect.anchoredPosition = new Vector2(32 + (64 * x), -32 - (64 * y)); piece.Initialize(val, new Point(x, y), pieces[val - 1]); // Why is val random? WHAT THE HELL!? node.SetPiece(piece); } } }
void InstantiateBoard() { for (int column = 0; column < width; column++) { for (int line = 0; line < height; line++) { Node node = getNodeAtCoord(new Coord(column, line)); int type = node.type; if (type <= 0) { continue; } GameObject node_object = Instantiate(nodePiece, gameBoard); NodePiece piece = node_object.GetComponent <NodePiece>(); RectTransform rect = node_object.GetComponent <RectTransform>(); rect.anchoredPosition = new Vector2(32 + (64 * column), -32 - (64 * line)); piece.Initialize(type, new Coord(column, line), sprites[type - 1]); node.SetPiece(piece); } } }
IEnumerator ClearCombo() { clearing = true; foreach (List <Point> pointList in comboList) { foreach (Point p in pointList) { Node node = getNodeAtPoint(p); NodePiece nodePiece = node.getPiece(); if (nodePiece != null) { nodePiece.transform.DORotate(Vector3.forward * 360, 0.4f, RotateMode.WorldAxisAdd).SetEase(Ease.OutQuad); nodePiece.transform.DOScale(Vector3.zero, 0.4f).SetEase(Ease.OutQuad).OnComplete(() => { nodePiece.transform.localScale = Vector3.one; nodePiece.transform.rotation = Quaternion.Euler(Vector3.zero); nodePiece.gameObject.SetActive(false); dead.Add(nodePiece); }); } node.SetPiece(null); } ProcessedData.Instance.combo += 1; ProcessedData.Instance.CalculateData(); if (comboList.IndexOf(pointList) == comboList.Count - 1) { yield return(null); } else { yield return(new WaitForSeconds(0.25f)); } } clearing = false; ApplyGravityToBoard(); StateManager.Instance.state = StateManager.State.dropping; }
void ApplyGravityToBoard() { for (int x = 0; x < width; x++) { for (int y = (height - 1); y >= 0; y--) //Start at the bottom and grab the next { Point p = new Point(x, y); Node node = getNodeAtPoint(p); int val = getValueAtPoint(p); if (val != 0) { continue; //If not a hole, move to the next } for (int ny = (y - 1); ny >= -1; ny--) { Point next = new Point(x, ny); int nextVal = getValueAtPoint(next); if (nextVal == 0) { continue; } if (nextVal != -1) { Node gotten = getNodeAtPoint(next); NodePiece piece = gotten.getPiece(); //Set the hole node.SetPiece(piece); update.Add(piece); //Make a new hole gotten.SetPiece(null); } else//Use dead ones or create new pieces to fill holes (hit a -1) only if we choose to { int newVal = fillPiece(); NodePiece piece; Point fallPnt = new Point(x, (-1 - fills[x])); if (dead.Count > 0) { NodePiece revived = dead[0]; revived.gameObject.SetActive(true); piece = revived; dead.RemoveAt(0); } else { GameObject obj = Instantiate(nodePiece, gameBoard); NodePiece n = obj.GetComponent <NodePiece>(); piece = n; } piece.Initialize(newVal, p, pieces[newVal - 1]); piece.rect.anchoredPosition = getPositionFromPoint(fallPnt); Node hole = getNodeAtPoint(p); hole.SetPiece(piece); ResetPiece(piece); fills[x]++; } break; } } } }
void ApplyGravityToBoard() { for (int x = 0; x < width; x++) { for (int y = (height - 1); y >= 0; y--) { Point p = new Point(x, y); Node node = getNodeAtPoint(p); int val = getValueAtPoint(p); // if it's not a hole, do nothing if (val != 0) { continue; } for (int ny = (y - 1); ny >= -1; ny--) { Point next = new Point(x, ny); int nextVal = getValueAtPoint(next); if (nextVal == 0) { continue; } // if we did not hit an end, but it's not 0 then use this to fill current hole if (nextVal != -1) { Node got = getNodeAtPoint(next); NodePiece piece = got.getPiece(); // Set the hole node.SetPiece(piece); update.Add(piece); // Replace the hole got.SetPiece(null); } else // If we hit an end { // Fill the hole with one of the dead pieces int newVal = fillPiece(); NodePiece piece; Point fallPnt = new Point(x, (-1 - fills[x])); if (dead.Count > 0) { NodePiece revived = dead[0]; revived.gameObject.SetActive(true); // Set initial position so the piece will spawn at the top and fall down revived.rect.anchoredPosition = getPositionFromPoint(fallPnt); piece = revived; dead.RemoveAt(0); } else { GameObject obj = Instantiate(nodePiece, gameBoard); NodePiece n = obj.GetComponent <NodePiece>(); RectTransform rect = obj.GetComponent <RectTransform>(); rect.anchoredPosition = getPositionFromPoint(fallPnt); piece = n; } piece.Initialize(newVal, p, pieces[newVal - 1]); Node hole = getNodeAtPoint(p); hole.SetPiece(piece); ResetPiece(piece); fills[x]++; } break; } } } }
public FlippedPieces(NodePiece o, NodePiece t) { one = o; two = t; }
void Update() { List <NodePiece> finishedUpdating = new List <NodePiece>(); for (int i = 0; i < update.Count; i++) { NodePiece piece = update[i]; if (!piece.UpdatePiece()) { finishedUpdating.Add(piece); } } for (int i = 0; i < finishedUpdating.Count; i++) { NodePiece piece = finishedUpdating[i]; FlippedPieces flip = getFlipped(piece); NodePiece flippedPiece = null; int x = (int)piece.index.x; fills[x] = Mathf.Clamp(fills[x] - 1, 0, width); List <Point> connected = isConnected(piece.index, true); bool wasFlipped = (flip != null); // If we flipped to make this update if (wasFlipped) { flippedPiece = flip.getOtherPiece(piece); AddPoints(ref connected, isConnected(flippedPiece.index, true)); } // If we didn't make a match if (connected.Count == 0) { // If we flipped if (wasFlipped) { // Flip back FlipPieces(piece.index, flippedPiece.index, false); } } // If we made a match else { // Remove the node pieces connected foreach (Point pnt in connected) { Node node = getNodeAtPoint(pnt); NodePiece nodePiece = node.getPiece(); if (nodePiece != null) { nodePiece.gameObject.SetActive(false); dead.Add(nodePiece); } node.SetPiece(null); } ApplyGravityToBoard(); } // Remove the flip after update flipped.Remove(flip); update.Remove(piece); } }
void Update() { List <NodePiece> finishedUpdating = new List <NodePiece>(); for (int i = 0; i < update.Count; i++) { NodePiece piece = update[i]; if (!piece.UpdatePiece()) { finishedUpdating.Add(piece); } } for (int i = 0; i < finishedUpdating.Count; i++) { NodePiece piece = finishedUpdating[i]; FlippedPieces flip = getFlipped(piece); NodePiece flippedPiece = null; int x = (int)piece.index.x; fills[x] = Mathf.Clamp(fills[x] - 1, 0, width); List <Point> connected = isConnected(piece.index, true); bool wasFlipped = (flip != null); if (wasFlipped && flipBackAfterWrongMove) // czy bez braku matcha ma zawracac na stare miejsce czy nie { flippedPiece = flip.getOtherPiece(piece); AddPoints(ref connected, isConnected(flippedPiece.index, true)); } if (connected.Count == 0) // jezeli nie ma spasowania { if (wasFlipped && flipBackAfterWrongMove) { FlipPieces(piece.index, flippedPiece.index, false); } } else { // jezeli jest spasowanie bool counter = true; foreach (Point pnt in connected) // Remove the node pieces connected { KillPiece(pnt); Node node = getNodeAtPoint(pnt); NodePiece nodePiece = node.getPiece(); if (counter == true) { PieceToSpawn = nodePiece; counter = false; } if (nodePiece != null) { nodePiece.gameObject.SetActive(false); dead.Add(nodePiece); } node.SetPiece(null); } //Debug.Log("usuwanie z match3"); Spawnitem(PieceToSpawn); ApplyGravityToBoard(); counter = true; } //Debug.Log("piece value"+PieceToSpawn.value); flipped.Remove(flip); update.Remove(piece); } }
public FlippedPieces(NodePiece o, NodePiece t) { one = o; two = t; // What is with the messed up naming? Preferable, nodePieceOne instead of o; }
void ApplyGravityToBoard() { for (int x = 4; x < 9; x++) { for (int y = 8; y > 3; y--) //Start at the bottom and grab the next { Point p = new Point(x, y); Node node = getNodeAtPoint(p); int val = getValueAtPoint(p); if (val != 0) { continue; //If not a hole, move to the next } for (int ny = (y - 1); ny >= 3; ny--) { Point next = new Point(x, ny); int nextVal = getValueAtPoint(next); if (nextVal == 0) { continue; } if (nextVal != -1) { Node got = getNodeAtPoint(next); NodePiece piece = got.getPiece(); //Set the hole node.SetPiece(piece); update.Add(piece); //Replace the hole got.SetPiece(null); } else //hit an end { //Fill in the hole int newVal = fillPiece(); NodePiece piece; Point fallPoint = new Point(x, 3); if (dead.Count > 0) { NodePiece revived = dead[0]; revived.gameObject.SetActive(true); revived.rect.anchoredPosition = getPositionFromPoint(fallPoint); piece = revived; dead.RemoveAt(0); } else { GameObject obj = Instantiate(nodePiece, gameBoard); NodePiece n = obj.GetComponent <NodePiece>(); RectTransform rect = obj.GetComponent <RectTransform>(); rect.anchoredPosition = getPositionFromPoint(fallPoint); piece = n; } piece.Initialize(newVal, p, pieces[newVal - 1]); Node hole = getNodeAtPoint(p); hole.SetPiece(piece); ResetPiece(piece); } break; } } } }
public FlippedPieces(NodePiece a, NodePiece b) { one = a; two = b; }
void Update() { if (gameFinished == false) { List <NodePiece> finishedUpdating = new List <NodePiece>(); timerText.text = "Time: " + timeRemaining.ToString(); if (score >= targetScore) { gameFinished = true; CancelInvoke(nameof(UpdateMatch3Game)); resultsPanel.SetActive(true); audioSource.clip = audioClips[1]; audioSource.Play(); Debug.Log("Game Complete - You Win!"); } for (int i = 0; i < update.Count; i++) { NodePiece piece = update[i]; if (piece.UpdatePiece() == false) { finishedUpdating.Add(piece); } } for (int i = 0; i < finishedUpdating.Count; i++) { NodePiece piece = finishedUpdating[i]; FlippedPieces flip = GetFlipped(piece); NodePiece flippedPiece = null; int x = (int)piece.index.x; fills[x] = Mathf.Clamp(fills[x] - 1, 0, width); List <Point> connected = IsConnected(piece.index, true); bool wasFlipped = (flip != null); // If flipped make this update if (wasFlipped) { flippedPiece = flip.GetOtherPiece(piece); AddPoints(ref connected, IsConnected(flippedPiece.index, true)); } // If match wasn't made if (connected.Count == 0) { // If flipped if (wasFlipped) { FlipPieces(piece.index, flippedPiece.index, false); // Flip pieces back } } else // If match is made { // Remove the node pieces that are connected foreach (Point p in connected) { KillPiece(p); Node node = GetNodeAtPoint(p); NodePiece nodePiece = node.GetPiece(); if (nodePiece != null) { nodePiece.gameObject.SetActive(false); dead.Add(nodePiece); } node.SetPiece(null); } audioSource.clip = audioClips[0]; audioSource.Play(); ApplyGravityToBoard(); } // Remove the flip after update flipped.Remove(flip); update.Remove(piece); } } }
public void ResetPiece(NodePiece piece) { piece.ResetPosition(); update.Add(piece); }
void ApplyGravityToBoard() { for (int column = 0; column < width; column++) { for (int line = (height - 1); line >= 0; line--) { Coord coord = new Coord(column, line); Node empty_node = getNodeAtCoord(coord); int type = getTypeAtCoord(coord); if (type != 0) // If it's not empty, than you don't need to do anything { continue; } for (int new_line = (line - 1); new_line >= -1; new_line--) { Coord next_coord = new Coord(column, new_line); int next_type = getTypeAtCoord(next_coord); if (next_type == 0) { continue; } else if (next_type != -1) // Did not hit the end, but it's not 0 { Node gem_node = getNodeAtCoord(next_coord); NodePiece gem = gem_node.GetPiece(); empty_node.SetPiece(gem); piecesToUpdate.Add(gem); gem_node.SetPiece(null); } else // Hit an end { int new_type = fillPieces(); NodePiece new_piece; Coord fallCoord = new Coord(column, -1 - fills[column]); if (dead.Count > 0) { new_piece = dead[0]; new_piece.gameObject.SetActive(true); dead.RemoveAt(0); } else { GameObject obj = Instantiate(nodePiece, gameBoard); new_piece = obj.GetComponent <NodePiece>(); } new_piece.Rect.anchoredPosition = getPositionFromCoord(fallCoord); new_piece.Initialize(new_type, coord, sprites[new_type - 1]); empty_node.SetPiece(new_piece); ResetPiece(new_piece); fills[column]++; } break; } } } }
// UPDATE once per frame void Update() { List <NodePiece> finishedUpdating = new List <NodePiece>(); for (int i = 0; i < update.Count; i++) { NodePiece piece = update[i]; if (!piece.UpdatePiece()) { finishedUpdating.Add(piece); } } for (int i = 0; i < finishedUpdating.Count; i++) { NodePiece piece = finishedUpdating[i]; FlippedPieces flip = getFlipped(piece); NodePiece flippedPiece = null; int x = (int)piece.index.x; fills[x] = Mathf.Clamp(fills[x] - 1, 0, width); List <Point> connected = isConnected(piece.index, true); bool wasFlipped = (flip != null); if (wasFlipped) // if we flipped, make this update { flippedPiece = flip.getOtherPiece(piece); AddPoints(ref connected, isConnected(flippedPiece.index, true)); // TODO figure out Ref } // The ref keyword in C# is used for passing or returning references of values to or from Methods. // Basically, it means that any change made to a value that is passed by reference will reflect // this change since you are modifying the value at the address and not just the value. // Basically, it changes the value outside of the method and not only within it. (Not for global variables) if (connected.Count == 0) // if no match { if (wasFlipped) // If we flipped { FlipPieces(piece.index, flippedPiece.index, false); // flip back } } else // If we made a match { foreach (Point pnt in connected) // remove nodes connected { KillPiece(pnt); Node node = getNodeAtPoint(pnt); NodePiece nodePiece = node.getPiece(); if (nodePiece != null) { nodePiece.gameObject.SetActive(false); dead.Add(nodePiece); } node.SetPiece(null); } ApplyGravityToBoard(); } flipped.Remove(flip); // Remove the flip after update update.Remove(piece); } }
void Update() { if (timer) { totalTime += Time.deltaTime; score.text = ((int)targetTime).ToString(); targetTime -= Time.deltaTime; if (targetTime <= 0.0f) { timerEnded(); } } List <NodePiece> finishedUpdating = new List <NodePiece>(); for (int i = 0; i < update.Count; i++) { NodePiece piece = update[i]; if (!piece.UpdatePiece()) { finishedUpdating.Add(piece); } } for (int i = 0; i < finishedUpdating.Count; i++) { NodePiece piece = finishedUpdating[i]; FlippedPieces flip = getFlipped(piece); NodePiece flippedPiece = null; int x = (int)piece.index.x; fills[x] = Mathf.Clamp(fills[x] - 1, 0, width); List <Point> connected = isConnected(piece.index, true); bool wasFlipped = (flip != null); if (wasFlipped) //If we flipped to make this update { flippedPiece = flip.getOtherPiece(piece); AddPoints(ref connected, isConnected(flippedPiece.index, true)); } if (connected.Count == 0) //If we didn't make a match { if (wasFlipped) //If we flipped { FlipPieces(piece.index, flippedPiece.index, false); //Flip back } } else //If we made a match { foreach (Point pnt in connected) //Remove the node pieces connected { if (timer) { targetTime += .5f; } else { scoreCount += 1; score.text = scoreCount.ToString(); } KillPiece(pnt); Node node = getNodeAtPoint(pnt); NodePiece nodePiece = node.getPiece(); if (nodePiece != null) { nodePiece.gameObject.SetActive(false); dead.Add(nodePiece); } node.SetPiece(null); } ApplyGravityToBoard(); } flipped.Remove(flip); //Remove the flip after update update.Remove(piece); } }
public FlippedPieces(NodePiece originPiece, NodePiece targetPiece) { one = originPiece; two = targetPiece; }
public void Spawnitem(NodePiece p) { //Debug.Log("spawnowanie itemka"); int itemToSpawn = p.value - 1; switch (itemToSpawn) { case 0: GameObject bone = Instantiate(items[0], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); bone.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 1: GameObject bottle_empty = Instantiate(items[1], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); bottle_empty.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 2: GameObject bowl_empty = Instantiate(items[2], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); bowl_empty.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 3: GameObject herbs = Instantiate(items[3], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); herbs.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 4: GameObject metal_scrap = Instantiate(items[4], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); metal_scrap.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 5: GameObject onion = Instantiate(items[5], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); onion.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 6: GameObject paper = Instantiate(items[6], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); paper.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 7: GameObject stick = Instantiate(items[7], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); stick.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 8: GameObject stone = Instantiate(items[8], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); stone.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 9: GameObject feather = Instantiate(items[9], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); feather.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 10: GameObject rope = Instantiate(items[10], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); rope.GetComponent <SpriteRenderer>().sortingOrder = 1; break; case 11: GameObject ink_bottle = Instantiate(items[11], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); ink_bottle.GetComponent <SpriteRenderer>().sortingOrder = 1; break; default: GameObject newItem = Instantiate(items[0], new Vector3(UnityEngine.Random.Range(4, 10), 6, 0), Quaternion.identity); newItem.GetComponent <SpriteRenderer>().sortingOrder = 1; break; } BossScript.instance.itemCount++; }