using UnityEngine;

using System;
using System.Collections;

public class Bullet : MonoBehaviour
{
    public float Speed = 15f;
    public float Damage = 0.05f;

    public ParticleSystem Explosion = null;

    public void Launch(Vector2 i_Direction)
    {
        rigidbody2D.velocity = (i_Direction * Speed);
    }

    void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.gameObject.CompareTag("Player"))
        {
            collider.gameObject.SendMessage("AddDamage", Damage);
        }

        GameObject.Instantiate(Explosion, transform.position, transform.rotation);

        Destroy(this.gameObject);
    }

}
