public override void Fire() { GameObject laser = new GameObject(); laser.transform.position = transform.position + (transform.forward * offset); laser.transform.rotation = transform.rotation; TurboLaser t = laser.AddComponent <TurboLaser>(); t.color = color; t.range = range; }
void OnCollisionEnter(Collision col) { //hullIntegrity -= col.relativeVelocity.magnitude * 0.05f; TurboLaser laser = col.gameObject.GetComponent <TurboLaser> (); if (laser) { hullIntegrity -= laser.damage; //hullIntegrity -= col.rigidbody.gameObject.GetComponent<TurboLaser>().damage; Debug.Log("LASER HIT"); } if (hullIntegrity <= -10) { //GameObject.Destroy(gameObject); } }