How to create shoots

I want to make a ship fires and one the fire hit other object ,it will be destroyed…Can anyone help me how to define fire? is it possible to use particle system or anything??

Alright, I’ll use a script I have already setup and will explain it to you.

var cannonballPrefab: Rigidbody; // Finds ammo. Must be on Scene to be found.

private var initialVelocity: float; // Starting Speed
private var cannonMuzzle: GameObject; // The Muzzle From where it shoots from
private var cannonBall: Rigidbody; // Place holder for the creation of the projectile
private var interaction: String; //interaction type
private var cannonName: String; // Returns cannon 
function Update () {
	cannonName = GameObject.Find("First Person Controller").GetComponent(Interactions).Cannon;
	initialVelocity = 200; // Setting speed
	cannonMuzzle = GameObject.Find(cannonName + "/WholeCannon/CannonBone/Projectiles"); //Will find the ammo
	interaction = GameObject.Find("First Person Controller").GetComponent(Interactions).interaction; //Check interaction

 if (Input.GetKeyDown("mouse 0") && interaction == "Cannon") {
 	cannonBall = Instantiate(cannonballPrefab, cannonMuzzle.transform.position, cannonMuzzle.transform.rotation); // Creates the projectile
 	cannonBall.velocity = transform.TransformDirection(Vector3.forward * initialVelocity); // Add a forward motion onto it.
 	cannonMuzzle.particleSystem.Play(); // Play fire animation
 	var Cannon: GameObject = GameObject.Find(cannonName);
	var animationComponent: Animation = Cannon.GetComponent(Animation);

I do not feel like trying to explain how to destroy the cannon upon impact, cause I do not feel able enough to correctly explain it to someone else like I can with this.

You can start by creating a prefab for your cannonballs or whatever you wan to shot. then make a script for your ship, that instantiates the prefab, and apply force to it at button down, like rigidbody.AddForce(2, 5,0); , dunno, sort of.

Create the prefab for the bullet. Add an empty GameObject as a child of the ship, and locate it in the tip of the barrel. Then, add this script to the ship, and then drag the objects to the respective variable. I’m doing this by memory, guess it should work:

var bullet : GameObject;
var bulletSpawn : GameObject;

function Update()
	if (Input.GetButtonDown("Shoot"))
		var bulletShoot = Instantiate(bullet, bulletSpawn.transform.position, bulletSpawn.transform.rotation);
		bulletShoot.AddForce(2, 5,0); //use the numbers that works for you