public virtual void Movement(Ray2D ry)
{
Debug.DrawRay(ry.origin, ry.direction, Color.green);
checkWall.direction = ry.direction;
//Casts a ray in front of the object to see if there are any obstacles blocking the path
if (Physics2D.Raycast(new Vector2(ry.origin.x,ry.origin.y-.5f),ry.direction,wallDist,whatIsWall))
{
//Changes the Direction the object faces to the opposite of its current Direction
Flip();
}
if(Anim!=null)
{
Anim.SetFloat ("Speed", speed);
}
//Move forward
transform.Translate(StartDir * speed * Time.deltaTime);
//Draws the Raycast so it is viewable in the editor
//Debug.DrawRay (ry.origin, ry.direction,Color.red);
}