private void CheckColorGhost() { CurrentGhost = FindObjectsOfType <Movement>(); foreach (Movement ghost in CurrentGhost) { if (ghost == null) { return; } switch (ghost.name) { case "Red": RedGhost.SetActive(false); RedGhostLocked.SetActive(true); break; case "Blue": BlueGhost.SetActive(false); BlueGhostLocked.SetActive(true); break; case "Orange": OrangeGhost.SetActive(false); OrangeGhostLocked.SetActive(true); break; case "Pink": PinkGhost.SetActive(false); PinkGhostLocked.SetActive(true); break; } } }
// Constructor public Game() { //Implementing the 4 type of ghost myGhosts[0] = new OrangeGhost(); myGhosts[1] = new BlueGhost(); myGhosts[2] = new RedGhost(); myGhosts[3] = new PinkGhost(); //Implementing the player myPlayer = new Player(); //Implementing the level myLevel = new Level(1); }
public int[] door; // coordinates of the door to ghosts' home public GamePlan(string pathToMap, int dotPoints, int ghostPoints, int[] redStart, int[] redHome, int[] pinkStart, int[] pinkHome, int[] blueStart, int[] blueHome, int[] yellowStart, int[] yellowHome) { // reads map from file and creates 4 ghosts according to initial data // redStart - coordinates of the red ghost starting tile // redHome - coordinates of the red ghost home - tile where it goes in Scatter mode ReadMapFromFile(pathToMap); this.dotPoints = dotPoints; this.ghostPoints = ghostPoints; this.curPoints = 0; dotsEaten = 0; livesLeft = Global.MAXLIVES; RedGhost red = new RedGhost(redStart[0], redStart[1], this, GhostMode.Chase, redHome[0], redHome[1]); PinkGhost pink = new PinkGhost(pinkStart[0], pinkStart[1], this, GhostMode.Wait, pinkHome[0], pinkHome[1]); BlueGhost blue = new BlueGhost(blueStart[0], blueStart[1], this, GhostMode.Wait, blueHome[0], blueHome[1]); YellowGhost yellow = new YellowGhost(yellowStart[0], yellowStart[1], this, GhostMode.Wait, yellowHome[0], yellowHome[1]); ghosts = new Ghost[] { red, pink, blue, yellow }; }