public void SpawnParticleEffect(Vector3 position, GameManager.ItemColor color) { Vector3 newSpawn = new Vector3(position.x, position.y, -1.5f); switch (color) { case GameManager.ItemColor.BLACK: Instantiate(particleBlack, newSpawn, Quaternion.identity); break; case GameManager.ItemColor.BLUE: Instantiate(particleBlue, newSpawn, Quaternion.identity); break; case GameManager.ItemColor.RED: Instantiate(particleRed, newSpawn, Quaternion.identity); break; case GameManager.ItemColor.MULTI: Instantiate(landEffect, newSpawn, Quaternion.identity); Instantiate(particleBlue, newSpawn, Quaternion.identity); Instantiate(particleRed, newSpawn, Quaternion.identity); break; } }
private int GetSpriteIndex(GameManager.ItemColor color, Sprite sprite) { int index = 0; switch (color) { case GameManager.ItemColor.BLACK: for (int i = 0; i < blackTreasure.Count; i++) { if (blackTreasure[i].GetComponent <SpriteRenderer>().sprite == sprite) { index = i; return(index); } } break; case GameManager.ItemColor.BLUE: for (int i = 0; i < blueTreasure.Count; i++) { if (blueTreasure[i].GetComponent <SpriteRenderer>().sprite == sprite) { index = i; return(index); } } break; case GameManager.ItemColor.RED: for (int i = 0; i < redTreasure.Count; i++) { if (redTreasure[i].GetComponent <SpriteRenderer>().sprite == sprite) { index = i; return(index); } } break; } return(index); }
public void SetColor(GameManager.ItemColor color) { if (color == GameManager.ItemColor.MULTI) { currentColor.sprite = colorSprites[(int)color]; orbAnim.SetTrigger("NewColor"); multiPowerupEnabled = true; timeAllColorReceived = Time.time; AudioManager.instance.PlayMusic(powerupMusic); myColor = color; return; } if ((int)color < colorSprites.Length) { if (currentColor.sprite != colorSprites[(int)color]) { currentColor.sprite = colorSprites[(int)color]; orbAnim.SetTrigger("NewColor"); if (color == GameManager.ItemColor.MULTI) { multiPowerupEnabled = true; timeAllColorReceived = Time.time; AudioManager.instance.PlayMusic(powerupMusic); } else { multiPowerupEnabled = false; } } } else { currentColor.sprite = null; multiPowerupEnabled = false; } myColor = color; }
public void SetCurrentScore(int points, GameManager.ItemColor color) { int digitCounter = 1; int value = points; while (value > 0) { int digit = value % 10; currentDigits[currentDigits.Length - digitCounter].sprite = digits[digit]; digitCounter++; value /= 10; } Color textColor; switch (color) { case GameManager.ItemColor.BLACK: textColor = Color.black; break; case GameManager.ItemColor.BLUE: textColor = new Color(0f / 255f, 52f / 255f, 157f / 255f); break; case GameManager.ItemColor.RED: textColor = new Color(137f / 255f, 0f / 255f, 11f / 255f); break; default: textColor = Color.black; break; } for (int i = 0; i < currentDigits.Length; i++) { currentDigits[i].color = textColor; } }