Subversion Repository Public Repository

Nextrek

Diff Revisions 133 vs 134 for /3DSpace/Assets/SpaceUnity/_Demo/Scrips/SU_LaserShot.cs

Diff revisions: vs.
  @@ -72,37 +72,12 @@
72 72 // throw particles out from the object we just hit...
73 73 Quaternion _rotation = Quaternion.FromToRotation(Vector3.up, _hit.normal);
74 74 // Instantiate the imapct effect at impact position
75 - if(_hit.transform.tag=="Player" && firedBy.tag!="Player")
76 - {
77 - Instantiate(impactEffect, _hit.point, _rotation);
78 - Life l = _hit.transform.GetComponent<Life>();
79 - if(l!=null)
80 - l.getHitted(hitpower);
81 - CommunicationCenter.Instance.ShowSmallCamera2(true);
82 - }
83 - else if(_hit.transform.tag=="Enemy")
84 - {
85 - Instantiate(impactEffect, _hit.point, _rotation);
86 - EnemyShip es = _hit.transform.GetComponent<EnemyShip>();
87 - if(es!=null)
88 - es.getHitted(hitpower);
89 - }
90 - else if(_hit.transform.tag=="Ally")
91 - {
92 - Instantiate(impactEffect, _hit.point, _rotation);
93 - AllyShip a = _hit.transform.GetComponent<AllyShip>();
94 - if(a !=null)
95 - a.getHitted(hitpower);
96 - }
97 - else if (_hit.transform.tag!="Player" && Random.Range(0,20) < 2)
98 - {
99 - MessageWindow.Instance.NewMessage ("An asteroid has been destroyed");
100 - Instantiate(impactEffect, _hit.point, _rotation);
101 - // Instantiate the explosion effect at the point of impact
102 - Instantiate(explosionEffect, _hit.transform.position, _rotation);
103 - // Destroy the game object that we just hit
104 - Destroy(_hit.transform.gameObject);
105 - }
75 +
76 + Instantiate(impactEffect, _hit.point, _rotation);
77 +
78 + // Call GameManager to handle weapon hit (damange, explosion, etc..)
79 + GameManager.HandleWeaponHit(_hit, hitpower, firedBy, explosionEffect, _rotation);
80 +
106 81 // Destroy the laser shot game object
107 82 Destroy(gameObject);
108 83 }