IEnumerator SpawnCD() { yield return(new WaitForSeconds(SpawnTimer)); if (wave == 1 && k == 0) { dead = 0; StartWave.SetActive(true); yield return(new WaitForSeconds(1)); sec--; yield return(new WaitForSeconds(1)); sec--; yield return(new WaitForSeconds(1)); StartWave.SetActive(false); sec = 3; yield return(new WaitForSeconds(0.5f)); nextwave.SetActive(true); yield return(new WaitForSeconds(2)); nextwave.SetActive(false); } switch (wave) { case 1: spawnmob = 6; if (dead < spawnmob) { for (int i = 0; i < 4; i++) { int number1 = Random.Range(0, 8); int Enemyn = Random.Range(1, 4); if (Enemyn == 1) { Instantiate(Enemy1, spawnPos[number1].position, Quaternion.identity); } if (Enemyn == 2) { Instantiate(Enemy2, spawnPos[number1].position, Quaternion.identity); } if (Enemyn == 3) { Instantiate(Enemy3, spawnPos[number1].position, Quaternion.identity); } yield return(new WaitForSeconds(0.3f)); } } if (dead >= spawnmob) { do { yield return(new WaitForSeconds(2f)); } while (dead != k); wave++; nextwave.SetActive(true); yield return(new WaitForSeconds(2)); nextwave.SetActive(false); k = 0; PlayerPrefs.SetInt("kolvo", k); Enemy.dead = 0; spawnmob = 10; break; } break; case 2: if (dead < spawnmob) { for (int i = 0; i < 4; i++) { int number1 = Random.Range(0, 8); int Enemyn = Random.Range(1, 4); if (Enemyn == 1) { Instantiate(Enemy1, spawnPos[number1].position, Quaternion.identity); } if (Enemyn == 2) { Instantiate(Enemy2, spawnPos[number1].position, Quaternion.identity); } if (Enemyn == 3) { Instantiate(Enemy3, spawnPos[number1].position, Quaternion.identity); } yield return(new WaitForSeconds(0.3f)); } } if (dead >= spawnmob) { do { yield return(new WaitForSeconds(2f)); } while (dead != k); wave++; nextwave.SetActive(true); yield return(new WaitForSeconds(2)); nextwave.SetActive(false); k = 0; PlayerPrefs.SetInt("kolvo", k); Enemy.dead = 0; spawnmob = 12; } break; case 3: if (dead < spawnmob) { for (int i = 0; i < 4; i++) { int number1 = Random.Range(0, 8); int Enemyn = Random.Range(1, 4); if (Enemyn == 1) { Instantiate(Enemy1, spawnPos[number1].position, Quaternion.identity); } if (Enemyn == 2) { Instantiate(Enemy2, spawnPos[number1].position, Quaternion.identity); } if (Enemyn == 3) { Instantiate(Enemy3, spawnPos[number1].position, Quaternion.identity); } yield return(new WaitForSeconds(0.3f)); } } if (dead >= spawnmob) { do { yield return(new WaitForSeconds(2f)); } while (dead != k); wave++; k = 0; PlayerPrefs.SetInt("kolvo", k); Enemy.dead = 0; compl.SetActive(true); yield return(new WaitForSeconds(2)); compl.SetActive(false); Teleport1.SetActive(true); StopCoroutine(SpawnCD()); break; } break; } if (wave < 4) { Repeat(); } else { wave = 0; Base.SetActive(true); Base1.SetActive(false); spawner.SetActive(false); } }
public static bool IsTeleporting(Mobile m, Direction d) { int newZ; Point3D oldLocation = m.Location; int x = oldLocation.X, y = oldLocation.Y; int oldX = x, oldY = y; int oldZ = oldLocation.Z; if (m.CheckMovement(d, out newZ)) { switch (d & Direction.Mask) { case Direction.North: --y; break; case Direction.Right: ++x; --y; break; case Direction.East: ++x; break; case Direction.Down: ++x; ++y; break; case Direction.South: ++y; break; case Direction.Left: --x; ++y; break; case Direction.West: --x; break; case Direction.Up: --x; --y; break; } } Point4D Telespot = new Point4D(x, y, newZ, m.Map.MapID); Teleport Teleport1; if (m_TeleportersD1.TryGetValue(Telespot, out Teleport1)) { if (Teleport1.OnMoveOver(m)) { return(true); } } else { Teleport Teleport2; if (m_TeleportersD2.TryGetValue(Telespot, out Teleport2)) { if (Teleport2.OnMoveOverReturn(m)) { return(true); } } } return(false); }