public override void MessUp(Transform user, Missile projectile) { Rigidbody rbody = projectile.GetComponent <Rigidbody>(); // Get projectile rigidbody rbody.useGravity = false; // do not allow gravity rbody.velocity = Vector3.zero; // Stop the missile from moving projectile.GetComponent <Collider>().enabled = false; projectile.Deactivate(); projectile.StartCoroutine(hailFire(user, projectile)); }
IEnumerator firePillar(Transform coll, Missile proj) { proj.Deactivate(); Rigidbody rbody = proj.GetComponent <Rigidbody>(); rbody.useGravity = false; rbody.isKinematic = true; proj.GetComponent <Collider>().enabled = false; ParticleSystem flame = Instantiate(tinyFlamePrefab, proj.transform.position, Quaternion.identity); ParticleSystem.MainModule flameMain = flame.main; while (flame.startLifetime > 0f) { flame.startLifetime -= Time.deltaTime; yield return(new WaitForEndOfFrame()); } // Transform newPillar = Instantiate(firePillarPrefab, flame.transform.position, Quaternion.identity); mainBlast(proj, flame.transform); Destroy(flame.gameObject); }