IEnumerator Missiles1to3() { shotState++; MissileManager.Shot(gameObject); yield return(new WaitForSeconds(1.5f)); MissileManager.ShotStop(gameObject); shotState++; yield return(new WaitForSeconds(1f)); shotState++; MissileManager.Shot(gameObject); yield return(new WaitForSeconds(10f)); Destroy(gameObject); }
// Update is called once per frame void Update() { if (player.transform.position.x > 106 && shotState == 0) { StartCoroutine("Missiles"); shotState = 1; } else if (shotState == 2) { MissileManager.TargetLockOn(new Vector3(0, transform.position.y, transform.position.z), gameObject); } else if (shotState == 4) { if (transform.position.x < pos.x - 92.5 + ((pos.z - 10) / 10) * 3.5f) { MissileManager.ShotStop(gameObject); MissileManager.TargetLockOn(new Vector3(transform.position.x, -7, 0), gameObject); } } }
IEnumerator Missile() { yield return(new WaitForSeconds(2f)); MissileManager.shotSpeed = 50; MissileManager.Shot(gameObject); yield return(new WaitForSeconds(2f)); transform.rotation = Quaternion.Euler(90, 0, 0); transform.position = new Vector3(transform.position.x, transform.position.y, 1f); MissileManager.shotSpeed = 20; MissileManager.Shot(gameObject); yield return(new WaitForSeconds(3f)); MissileManager.ShotStop(gameObject); yield return(new WaitForSeconds(2f)); MissileManager.Shot(gameObject); yield return(new WaitForSeconds(20f)); Destroy(gameObject); }
IEnumerator Missile() { yield return(new WaitForSeconds(2f)); MissileManager.shotSpeed = 50; MissileManager.Shot(gameObject); yield return(new WaitForSeconds(2f)); if (i < 2) { transform.position = new Vector3(40, 5 + (i * 10), -1.5f); transform.rotation = Quaternion.Euler(0, 90, 0); } else if (i >= 2 && i < 6) { transform.position = new Vector3(transform.position.x, 40, -1.5f); transform.rotation = Quaternion.Euler(90, 0, 0); } else { transform.position = new Vector3(126, 5 + ((i - 6) * 10), -1.5f); transform.rotation = Quaternion.Euler(0, -90, 0); } MissileManager.shotSpeed = 20; MissileManager.Shot(gameObject); yield return(new WaitForSeconds(1f)); MissileManager.ShotStop(gameObject); ShotState = 2; yield return(new WaitForSeconds(2f)); MissileManager.Shot(gameObject); yield return(new WaitForSeconds(20f)); Destroy(gameObject); }
IEnumerator Missile() { yield return(new WaitForSeconds(2f)); MissileManager.shotSpeed = 50; MissileManager.Shot(gameObject); yield return(new WaitForSeconds(1.5f)); if (i < 1) { transform.position = new Vector3(40, -1.5f, -0.5f); transform.rotation = Quaternion.Euler(0, 90, 0); } else if (i >= 1 && i < 4) { transform.position = new Vector3(transform.position.x, 40, 3.5f); transform.rotation = Quaternion.Euler(90, 0, 0); } else if (i >= 4 && i < 7) { transform.position = new Vector3(transform.position.x, 40, -3.5f); transform.rotation = Quaternion.Euler(90, 0, 0); } else { transform.position = new Vector3(126, -1.5f, 0.5f); transform.rotation = Quaternion.Euler(0, -90, 0); } MissileManager.shotSpeed = 20; MissileManager.Shot(gameObject); yield return(new WaitForSeconds(1f)); MissileManager.ShotStop(gameObject); yield return(new WaitForSeconds(2f)); if (i < 1) { MissileManager.Shot(gameObject); } yield return(new WaitForSeconds(1f)); if (i >= 1 && i < 4) { MissileManager.Shot(gameObject); } yield return(new WaitForSeconds(1f)); if (i >= 4 && i < 7) { MissileManager.Shot(gameObject); } yield return(new WaitForSeconds(1f)); if (i >= 7) { MissileManager.Shot(gameObject); } yield return(new WaitForSeconds(20f)); Destroy(gameObject); }