private void Start() { rb = GetComponent <Rigidbody2D>(); refTime = -1f; currTime = 0f; cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>(); }
void Start() { cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>(); int nbDeath = cd.nbDeath; int diff = cd.difficulty; int whichLevel = cd.levelPlaying; if (whichLevel == 1) { if (nbDeath > 3) { GetComponent <Text>().text = nbDeath + " deaths, I have seen better, but nice job I guess."; } else if (nbDeath > 0) { GetComponent <Text>().text = nbDeath + " deaths, not that bad... Congratulation I guess."; } else if (nbDeath == 0 && diff != 3) { GetComponent <Text>().text = "You didn't even die once, you are better than what I would expect. But you were not on the hardest mode thought."; } else if (nbDeath == 0 && diff == 3) { GetComponent <Text>().text = "You didn't even die once, you are better than what I would expect. I would have made you a cake if I knew how to cook."; } } else if (whichLevel == 2) { if (nbDeath > 3) { GetComponent <Text>().text = nbDeath + " deaths, I have seen better, but nice job I guess."; } else if (nbDeath > 0) { GetComponent <Text>().text = nbDeath + " deaths, not that bad... Congratulation I guess."; } else if (nbDeath == 0 && diff != 3) { GetComponent <Text>().text = "You didn't even die once, you are better than what I would expect. But you were not on the hardest mode thought."; } else if (nbDeath == 0 && diff == 3) { GetComponent <Text>().text = "You didn't even die once, to be honnest I'm pretty impressed. Congratulation."; } } else if (whichLevel == 7) { GetComponent <Text>().text = "Thanks for finishing the tutorial, you are now ready to play."; } }
private void Start() { CountDeath cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>(); networkPort = cd.port; if (cd.doesHost) { StartHost(); } else { networkAddress = cd.ip; StartClient(); } }
void Start() { cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>(); laserRobots.colors = setBlockColor(laserRobots.colors, (cd.laserRobots) ? (Color.green) : (Color.red)); pushRobots.colors = setBlockColor(pushRobots.colors, (cd.pushRobots) ? (Color.green) : (Color.red)); crates.colors = setBlockColor(crates.colors, (cd.crates) ? (Color.green) : (Color.red)); shakePowerup.colors = setBlockColor(shakePowerup.colors, (cd.shakePowerup) ? (Color.green) : (Color.red)); keyboardPowerup.colors = setBlockColor(keyboardPowerup.colors, (cd.keyboardPowerup) ? (Color.green) : (Color.red)); magnetPowerup.colors = setBlockColor(magnetPowerup.colors, (cd.magnetPowerup) ? (Color.green) : (Color.red)); cornerPowerup.colors = setBlockColor(cornerPowerup.colors, (cd.cornerPowerup) ? (Color.green) : (Color.red)); gunPowerup.colors = setBlockColor(gunPowerup.colors, (cd.gunPowerup) ? (Color.green) : (Color.red)); visionPowerup.colors = setBlockColor(visionPowerup.colors, (cd.visionPowerup) ? (Color.green) : (Color.red)); duplicatePowerup.colors = setBlockColor(duplicatePowerup.colors, (cd.duplicatePowerup) ? (Color.green) : (Color.red)); timerPowerup.colors = setBlockColor(timerPowerup.colors, (cd.timerPowerup) ? (Color.green) : (Color.red)); trapPowerup.colors = setBlockColor(trapPowerup.colors, (cd.trapPowerup) ? (Color.green) : (Color.red)); }
private void Start() { CountDeath cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>(); cd.nbDeath++; if (cd.levelPlaying == 3) { GetComponent <Text>().text = "Your score: " + cd.score; } else { sentence = GetComponent <Text>(); switch (Random.Range(0, 10)) { case 0: sentence.text = "Are you even trying ?"; break; case 1: sentence.text = "Death won't save you, I still have many clones of you."; break; case 2: sentence.text = "Is dying the only thing you can do ?"; break; case 3: sentence.text = "If doing mistake really help to learn, you would be a god right now."; break; case 4: sentence.text = "That was fun but you can begin to try now."; break; case 5: sentence.text = "Why the robots aren't helping you ? They consider you as too unevoled to survive."; break; case 6: sentence.text = "Did you try using your brain instead of running into lasers ?"; break; case 7: sentence.text = "Running into lasers won't make them malfunction, you can't stop with this strategy now."; break; case 8: sentence.text = "I wish I had someone clever to do this job but I'm stuck with you instead..."; break; case 9: sentence.text = "There is a cake awaiting you at the end... Maybe..."; break; } sentence.text += System.Environment.NewLine + System.Environment.NewLine + System.Environment.NewLine + "(You died " + cd.nbDeath + " times.)"; } }
private void Start() { currTime = -1f; currTimeDead = -1f; angleDeriv = 0f; secondWeapon = true; currReload = 0f; magnetForce = 0f; up = "Up"; down = "Down"; left = "Left"; right = "Right"; impulse = Vector2.zero; if (SceneManager.GetActiveScene().name == "DeathScene" || SceneManager.GetActiveScene().name == "MultiScene" || SceneManager.GetActiveScene().name == "RandomScene") { inIntro = false; } else { inIntro = true; } cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>(); diff = cd.difficulty; if (deathText != null) { deathText.text = cd.nbDeath.ToString(); } darkCounter = 0; addForce = 0; sr = GetComponent <SpriteRenderer>(); rb = GetComponent <Rigidbody2D>(); score = 0; mainCam = Camera.main; isNetwork = (GetComponent <NetworkIdentity>() != null); isPause = false; }
private void Start() { cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent<CountDeath>(); setDiff(cd.difficulty); }
void Start() { cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>(); diff = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>().difficulty; map = new Item[30, maxY]; for (int i = 0; i < 30; i++) { for (int y = 0; y < maxY; y++) { map[i, y].go = null; map[i, y].supp = 0; } } int maxMove; if (cd.laserRobots) { if (diff == 1) { maxMove = 1; } else if (diff == 2) { maxMove = 1; } else if (diff == 3) { maxMove = Random.Range(1, 3); } else { throw new System.Exception("diff have an invalid value."); } } else { maxMove = 0; } int maxFreeze; if (cd.pushRobots) { if (diff == 1) { maxFreeze = 1; } else if (diff == 2) { maxFreeze = Random.Range(1, 3); } else if (diff == 3) { maxFreeze = Random.Range(2, 4); } else { throw new System.Exception("diff have an invalid value."); } } else { maxFreeze = 0; } int maxWall; if (diff == 1) { maxWall = Random.Range(5, 11); } else if (diff == 2) { maxWall = Random.Range(10, 16); } else if (diff == 3) { maxWall = Random.Range(15, 21); } else { throw new System.Exception("diff have an invalid value."); } int maxCrate; if (cd.crates) { if (diff == 1) { maxCrate = Random.Range(1, 4); } else if (diff == 2) { maxCrate = Random.Range(2, 5); } else if (diff == 3) { maxCrate = Random.Range(3, 7); } else { throw new System.Exception("diff have an invalid value."); } } else { maxCrate = 0; } int chanceSpawn = 50; for (int i = 0; i < maxWall; i++) { int xPos, yPos; do { xPos = Random.Range(0, 30); yPos = Random.Range(0, maxY); } while (map[xPos, yPos].go != null || !isAreaFree(new Vector2(xPos, yPos))); map[xPos, yPos].go = wall; } int nbLasers = maxWall; for (int i = 0; i < 30; i++) { for (int y = 0; y < maxY; y++) { if (map[i, y].go != null) { if (map[i, y].go == wall) { Vector2[] allPos = new Vector2[4] { new Vector2(0, 1), new Vector2(1, 0), new Vector2(-1, 0), new Vector2(0, -1) }; bool[] doesRot = new bool[4] { false, true, true, false }; Vector2 currPos = new Vector2(i, y); if (Random.Range(0, 100) < chanceSpawn || nbLasers + maxWall / 3 < maxWall) { nbLasers--; int z = Random.Range(0, 4); if (isDirectionWall(currPos + allPos[z], allPos[z])) { addLasers(currPos + allPos[z], allPos[z], doesRot[z]); } } } } } } for (int i = 0; i < maxCrate; i++) { int xPos, yPos; do { xPos = Random.Range(0, 30); yPos = Random.Range(0, maxY); } while (map[xPos, yPos].go != null); map[xPos, yPos].go = box; } for (int i = 0; i < maxMove; i++) { int xPos, yPos; do { xPos = Random.Range(0, 30); yPos = Random.Range(0, maxY); } while (map[xPos, yPos].go != null); map[xPos, yPos].go = robotMove; } for (int i = 0; i < maxFreeze; i++) { int xPos, yPos; do { xPos = Random.Range(2, 30 - 2); yPos = Random.Range(2, maxY - 2); } while (map[xPos, yPos].go != null); map[xPos, yPos].go = robotFreeze; } for (int i = 0; i < 8; i++) { int xPos, yPos; do { xPos = Random.Range(0, 30); yPos = Random.Range(0, maxY); } while (map[xPos, yPos].go != null); map[xPos, yPos].go = objective; } int nbShake = 0; int nbKeyboard = 0; int nbAim = 0; int nbCorner = 0; int nbGun = 0; int nbVision = 0; int nbDuplicate = 0; int nbTimer = 0; int nbTrap = 0; for (int i = 0; i < 30; i++) { for (int y = 0; y < maxY; y++) { if (map[i, y].go != null) { GameObject go; if (map[i, y].go == laser && map[i, y].supp == 2) { go = Instantiate(map[i, y].go, new Vector2(i * 0.5f + -7.22f, y * -0.5f + 4.49f), Quaternion.Euler(0, 0, 90)); } else if (map[i, y].go == laser && map[i, y].supp == 3) { go = Instantiate(map[i, y].go, new Vector2(i * 0.5f + -7.22f, y * -0.5f + 4.49f), Quaternion.Euler(0, 0, 90)); GameObject go2 = Instantiate(map[i, y].go, new Vector2(i * 0.5f + -7.22f, y * -0.5f + 4.49f), Quaternion.identity); go2.GetComponent <MoveLaser>().pc = player.GetComponent <PlayerController>(); go2.GetComponent <MoveLaser>().gameOver = gameOver; } else { go = Instantiate(map[i, y].go, new Vector2(i * 0.5f + -7.22f, y * -0.5f + 4.49f), Quaternion.identity); } if (map[i, y].go == laser) { go.GetComponent <MoveLaser>().pc = player.GetComponent <PlayerController>(); go.GetComponent <MoveLaser>().gameOver = gameOver; } else if (map[i, y].go == objective) { if (!cd.shakePowerup && !cd.keyboardPowerup && !cd.magnetPowerup && !cd.cornerPowerup && !cd.gunPowerup && !cd.visionPowerup && !cd.duplicatePowerup && !cd.timerPowerup && !cd.trapPowerup) { map[i, y].go.GetComponent <PowerDown>().pde = (PowerDown.powerDownE) 5; // None } else { int randomNb; int it = 0; do { randomNb = Random.Range(0, 9); if (randomNb == 1) { randomNb = 3; } else if (randomNb == 2) { randomNb = 4; } else if (randomNb == 3) { randomNb = 1; } else if (randomNb == 4) { randomNb = 6; } else if (randomNb == 5) { randomNb = 7; } else if (randomNb == 6) { randomNb = 8; } else if (randomNb == 7) { randomNb = 9; } else if (randomNb == 8) { randomNb = 10; } it++; if (it == 100) { randomNb = 5; break; } } while ((randomNb == 0 && !cd.shakePowerup) || (randomNb == 3 && !cd.keyboardPowerup) || (randomNb == 4 && !cd.magnetPowerup) || (randomNb == 1 && !cd.cornerPowerup) || (randomNb == 6 && !cd.gunPowerup) || (randomNb == 7 && !cd.visionPowerup) || (randomNb == 8 && !cd.duplicatePowerup) || (randomNb == 9 && !cd.timerPowerup) || (randomNb == 10 && !cd.trapPowerup) || (randomNb == 0 && nbShake >= 4) || (randomNb == 3 && nbKeyboard >= 2) || (randomNb == 4 && nbAim >= 4) || (randomNb == 1 && nbCorner >= 4) || (randomNb == 6 && nbGun >= 1) || (randomNb == 7 && nbVision >= 1) || (randomNb == 8 && nbDuplicate >= 1) || (randomNb == 9 && nbTimer >= 1) || (randomNb == 10 && nbTrap >= 4)); if (randomNb == 0) { nbShake++; } else if (randomNb == 3) { nbKeyboard++; } else if (randomNb == 4) { nbAim++; } else if (randomNb == 1) { nbCorner++; } else if (randomNb == 6) { nbGun++; } else if (randomNb == 7) { nbVision++; } else if (randomNb == 8) { nbDuplicate++; } else if (randomNb == 9) { nbTimer++; } else if (randomNb == 10) { nbTrap++; } map[i, y].go.GetComponent <PowerDown>().pde = (PowerDown.powerDownE)randomNb; } } else if (map[i, y].go == robotMove) { go.GetComponent <KillPlayer>().player = player; go.GetComponentInChildren <MoveLaser>().pc = player.GetComponent <PlayerController>(); go.GetComponentInChildren <MoveLaser>().gameOver = gameOver; } else if (map[i, y].go == robotFreeze) { go.GetComponent <LaunchCrate>().player = player; } } } } }
private void Start() { currentLevel = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>().levelPlaying; cd = GameObject.FindGameObjectWithTag("DeathManager").GetComponent <CountDeath>(); }