private void ColorPicker(Dot dot, string tag) { if(tag == "red") { dot.color = dotManager.arrayOfDotColors[2]; dot.tag = tag; } else if(tag == "green") { dot.color = dotManager.arrayOfDotColors[1]; dot.tag = tag; } else if(tag == "blue") { dot.color = dotManager.arrayOfDotColors[0]; dot.tag = tag; } else if(tag == "yellow") { dot.color = dotManager.arrayOfDotColors[4]; dot.tag = tag; } else if(tag == "purple"){ dot.color = dotManager.arrayOfDotColors[3]; dot.tag = tag; }else { Debug.LogError(tag + " is an invalid - check the obstacle prefabs for an incorrect tag"); } }
public void CollisionWithLine (Dot collidedDot = null) { if (dotsInLine.Count > 0 && !collidedDot.isPowerup && collidedDot.color != lineColor && collidedDot.tag != dotsInLine[0].tag && lineColor != Color.white && !collidedDot.isObstacle && collidedDot.tag != "gem") { lineBeingDrawn = false; if(livesClass.currentLives == 0) { ClearLine(); /* highscore setting */ if (PlayerPrefs.HasKey("highScore") && score > PlayerPrefs.GetInt("highScore")) PlayerPrefs.SetInt("highScore",score); PlayerPrefs.Save(); //livesClass.SetLifeTotal(0); audioManager.soundFX[2].Play(); //Time.timeScale = 0.1f; //guiManager.deathMenuRoot.SetActive(true); //guiManager.guiActive = true; foreach(Obstacle ob in obstacleManager.obstacles) { Destroy (ob.gameObject); } obstacleManager.obstacles = new List<Obstacle>(); StartCoroutine(OpenDeathMenu()); } else { foreach(Dot dot in allDots) { if(dot.isPowerup) dot.background.color = Color.white; } livesClass.RemoveLife(); audioManager.soundFX[2].Play(); ClearLine(); lineBeingDrawn = false; } } }
private void Start() { dot = gameObject.GetComponent<Dot> () as Dot; powerupManager = dot.dotManager.powerupManager; }