public void FireMissile() { GameObject newMissile = EmWeapons.GetMissile(); newMissile.GetComponent <MissileScript>().isRocketAngel = false; Target = ChooseTarget(); if (NumberShot % 2 == 0) { newMissile.transform.position = Launchers[0].transform.position; newMissile.transform.rotation = Launchers[0].transform.rotation; NumberShot++; } else { newMissile.transform.position = Launchers[1].transform.position; newMissile.transform.rotation = Launchers[1].transform.rotation; NumberShot++; } //newMissile.GetComponent<Rigidbody2D>().velocity = (Target.transform.position - transform.position).normalized * 10f * Time.deltaTime; //newMissile.transform.rotation = Quaternion.LookRotation(Vector3.forward, -(Target.transform.position - transform.position).normalized); newMissile.GetComponent <Damage>().DMG = (int)GetComponent <ShipManagement>().Ship.MainWeapon.Damage[(int)GM.ActiveStage]; newMissile.SetActive(true); am.PlayFromTime("MissileShoot", .25f, .5f, 2f); }
IEnumerator Attack2() { CanShootAttack2 = false; yield return(new WaitForSeconds(1f)); for (int i = 0; i < NumberOfMissilesToShoot; i++) { GameObject Go = EmWeapons.GetMissile(); Go.GetComponent <MissileScript>().ShouldFindTarget = true; Go.transform.position = ChoosePosition(Attack2SpawnPoints).position; Go.SetActive(true); Go.GetComponent <Damage>().DMG = (int)BossWeapons[1].Damage[0]; am.Play("MisslieShoot", .25f); } yield return(new WaitForSeconds(BossWeapons[1].Delay)); Stages = ChooseAttackToUse(); CanShootAttack2 = true; }