How to make a Ray class?

I want to make a non-monobehaviour class that casts a ray from each object that uses an instance of the class:

#pragma strict

class TEST1
{

	var object 		: Transform;
	var hit 		: RaycastHit;
	var distance 	        : int = 10;
	var origin 		: Vector3;
	
	function TEST1 (obj : Transform)
	{
		object = obj;
		origin = object.position;
	}

		
	function Update()
	{	
		
		Physics.Raycast(origin, Vector3(0,10,0), hit,distance);
		{
			if(hit.transform.tag == "a")
			{
				print("a");
			}
		}
		Debug.DrawRay(origin,Vector3(0,10,0),Color.red);
	}
}

The class recieves the transform of an object and uses it co cast a ray from the objects position to a Vector3 position;

If I use it as a monobehaviour class (class TEST1 extends MonoBehaviour) and attach the script to a gameObject it will work just fineā€¦but I want to know if its possible to get the same results without it inheriting from MonoBehaviour.

This script would not work without inheriting from monoBehaviour, because update() is a monoBehaviour method.

You could name the function something else, but you would still need another monoBehaviour class to call your raycast function every frame. So, while you would have your non-monBehaviour raycast class, it would depend on another class to work.

Even if you changed when you raycast, to say, not every update, but every collision, or every button press, you would STILL need monoBehaviour methods to check for all that.