using UnityEngine;
using System.Collections;

public class LaserRayCast : MonoBehaviour 
{
    void Update () 
    {
        Vector3 Position = this.transform.position;
        Vector3 Direction = -this.transform.up;
        RaycastHit HitInfo;
        if (Physics.Raycast(Position, Direction, out HitInfo))
        {
            if (HitInfo.collider.gameObject.name == "Character" || HitInfo.collider.gameObject.tag == "Robot")
            {
                //Oyuncuyu yok et.
                Debug.Log(HitInfo.collider.gameObject.name + " is killed by " + this.name);
                //if (HitInfo.collider.gameObject != null)
                    Destroy(HitInfo.collider.gameObject);
            }
        }
	}
}
