Subversion Repository Public Repository

Nextrek

Diff Revisions 117 vs 125 for /3DSpace/Assets/Custum/Scripts/LaunchMissile.cs

Diff revisions: vs.
  @@ -10,17 +10,15 @@
10 10 {
11 11 if(Input.GetKeyDown(KeyCode.LeftControl))
12 12 {
13 - if(bullets.bullets_n>0)
13 + //if(bullets.bullets_n>0)
14 14 {
15 - GameObject target = GameObject.Find("EnemyshipRoot");
16 - if(target && target.tag=="Enemy")
17 - {
18 - Transform miss = (Transform)Instantiate(missile,startPos.position,Quaternion.identity);
19 - Missile m = miss.GetComponent<Missile>();
20 - m.SetTarget(target.transform);
21 - bullets.bullets_n--;
22 - if(soundEffect!=null)audio.PlayOneShot(soundEffect);
23 - }
15 + Transform heroSpaceShip = GameManager.GetHero();
16 + if (heroSpaceShip==null) return;
17 +
18 + Transform miss = (Transform)Instantiate(missile,startPos.position,heroSpaceShip.transform.rotation);
19 +
20 + //bullets.bullets_n--;
21 + if(soundEffect!=null)audio.PlayOneShot(soundEffect);
24 22 }
25 23 }
26 24 }