using UnityEngine;
using System.Collections;

public class Shooter : MonoBehaviour {
    public GameObject projectile;
    public int damage = 1;
    public float speed = 500f;
    public float frequency = 2f;
    private float nextShot = 0f;

    void Update() {
        if (Time.time > nextShot) {
            GameObject go = (GameObject)Instantiate(projectile, transform.position, Quaternion.identity);
            go.transform.SetLocalY(go.transform.localPosition.y + 2f);
            go.GetComponent<Rigidbody>().AddForce(Vector3.up * speed, ForceMode.Acceleration);

            nextShot = Time.time + frequency;
        }
    }
}
