need help

hi so i am having so problems with my code i been at it for 3 days now and im confused i dont ask many questions on the forums but i got nowhere else to go plzzz help i do have all rights for this code i did make some of it and i did get help. ty for your time

 using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.ObjectModel;

public class PlayerAttack1 : MonoBehaviour {
public List<Transform> targets;
public Transform selectedTarget;
private Transform myTransform;
private GameObject target;
public float attackTimer;
public float coolDown;
private bool SetActiveRecursively;
public int damage = 10;
public int curEnergie = 100;
public int maxEnergie = 100;
public int curMana = 100;
public int maxMana = 100;
public int Energie = 5;
public int Mana = 10;
public float duringTime = 0;
public float MaxTime = 30f;
public float ManaBar = 300f;
public float EnergieBar = 300f;
public float RestingTime = 0;
public float restTime = 60f;
private float playerDamage;
private float strength;
private Vector3 distance;
public GUIStyle Estyle;
public GUIStyle Mstyle;

	// Use this for initialization
	void Start ()
	{
		strength = 10.0f;
		playerDamage = 1.02f * strength;
		
		attackTimer = 0;
		coolDown = 3.0f;
		RestingTime = restTime;
		
			
		targets = new List<Transform>();
		selectedTarget = null;
		myTransform = transform;
		
		AddAllEnemies();
	}
	public void AddAllEnemies()
	{
		GameObject[] go = GameObject.FindGameObjectsWithTag("Enemy");
		
		foreach(GameObject enemy in go)
			AddTarget(enemy.transform);
		
	}
	public void AddTarget(Transform enemey)
	{
		targets.Add(enemey);
	}
	private void sortTargetsByDistance()
	{
		targets.Sort(delegate(Transform t1, Transform t2) {
			return Vector3.Distance(t1.position, myTransform.position).CompareTo(Vector3.Distance(t2.position, myTransform.position));
				});
		}
	
	private void TargetEnemey()
	{
		if(selectedTarget == null)
		{
			sortTargetsByDistance();
			selectedTarget = targets[0];
		}
		else
		{
			int index = targets.IndexOf(selectedTarget);
			
			if(index < targets.Count - 1)
			{
				index++;
			}
			else
			{
				index = 0;
			}
			
			DeselectTarget();
			selectedTarget = targets[index];
	}
		SelectTarget();
}
	private void SelectTarget()
	{
		Transform name = selectedTarget.FindChild("EnemyName");
		
		if(name == null) {
			Debug.LogError("could not find the name of the enemy " + selectedTarget.name);
			return;
		}
		
		name.GetComponent<TextMesh>().text = selectedTarget.GetComponent<MobName>().name;
		name.GetComponent<MeshRenderer>().enabled = true;
	}
	
	private void DeselectTarget()
	{
		selectedTarget.FindChild("EnemyName").GetComponent<MeshRenderer>().enabled = false;
		selectedTarget = null;
	}
	
	void OnGUI ()
	{
		GUI.Box(new Rect(10, 54, EnergieBar, 20), curEnergie + "/" + maxEnergie, Estyle);
		GUI.Box(new Rect(10, 76, ManaBar, 20), curMana + "/" + maxMana, Mstyle);
	}
	
	// Update is called once per frame
	void Update () 
	{
		Attack();
		
		if(distance < 6.0f  direction > 0)
		{
			TargetEnemey();
		}
	   if(attackTimer > 0)
		{
		attackTimer -= Time.deltaTime;
		}
	   if(duringTime > 0)
		{
		duringTime -= Time.deltaTime;
		}
	   if(duringTime < 0)
		{
		duringTime = 0;
		}
	   if(attackTimer < 0)
		{
		attackTimer = 0;
		}
	   if(RestingTime < 0)
		{
		RestingTime = 0;
		}
	   if(RestingTime > 0)
		{
		RestingTime -= Time.deltaTime;
		}
	   if(curEnergie > maxEnergie)
		{
		curEnergie = maxEnergie;
		}
	   if(RestingTime == 0)
		{
			curEnergie = maxEnergie;
		    EnergieBar = 300f;
		    RestingTime = restTime;
		}
		  
		
	   if(curEnergie < 0)
			curEnergie = 0;
		
	   if(curMana > maxMana)
			curMana = maxMana;
		
	   if(curMana < 0)
			curMana = 0;
		
	if(distance < 8.0f) {
			
	   if(Input.GetMouseButtonUp(0))
		{
			if(attackTimer == 0)
			{
			   Attack();
			   attackTimer = coolDown;
				curEnergie -= Energie;
				EnergieBar -= 15f;
				damage = 20;
			}
		}
	   if(Input.GetMouseButtonDown(1))
		{
			if(curMana > 0)
			{
				Attack();
				curMana -= Mana;
				ManaBar -= 30f;
				damage = 40;
				duringTime = MaxTime;
			}
		}
	}
}
	
	// attack
	void Attack ()	{
		
		float distance = Vector3.distance(targets.transform.position, Vector3.Angle, transform.position);
		
		Vector3 dir = (targets.transform.position - transform.position).normalized;
		
		float direction = Vector3.Dot(dir, transform.forward);

				EnemyHealth eh = (EnemyHealth)targets.GetComponent<EnemyHealth>().damage(EnemeyHealth);
				eh.AddjustCurrentHealth(-damage);
		}
	}

my errors are

Assets/Scripts/PlayerAttack1.cs(125,20): error CS0019: Operator <' cannot be applied to operands of type UnityEngine.Vector3’ and `float’

Assets/Scripts/PlayerAttack1.cs(174,12): error CS0019: Operator <' cannot be applied to operands of type UnityEngine.Vector3’ and `float’

Assets/Scripts/PlayerAttack1.cs(204,42): error CS0117: UnityEngine.Vector3' does not contain a definition for distance’

Assets/Scripts/PlayerAttack1.cs(206,40): error CS1061: Type System.Collections.Generic.List<UnityEngine.Transform>' does not contain a definition for transform’ and no extension method transform' of type System.Collections.Generic.List<UnityEngine.Transform>’ could be found (are you missing a using directive or an assembly reference?)

Assets/Scripts/PlayerAttack1.cs(210,71): error CS1061: Type System.Collections.Generic.List<UnityEngine.Transform>' does not contain a definition for GetComponent’ and no extension method GetComponent' of type System.Collections.Generic.List<UnityEngine.Transform>’ could be found (are you missing a using directive or an assembly reference?)

and i just got this error from nowhere lol

ArgumentOutOfRangeException: < 0 || >= this.Length
Parameter name: startIndex
System.String.LastIndexOf (Char value, Int32 startIndex, Int32 count)
System.String.LastIndexOf (Char value, Int32 startIndex)
UnityEngine.TextEditor.SelectToPosition (Vector2 cursorPosition)
UnityEditor.EditorGUI.DoTextField (UnityEditor.RecycledTextEditor editor, Int32 id, Rect position, System.String text, UnityEngine.GUIStyle style, System.String allowedletters, System.Boolean changed, Boolean reset, Boolean multiline, Boolean passwordField)
UnityEditor.EditorGUI.TextArea (Rect position, System.String text, UnityEngine.GUIStyle style)
UnityEditor.EditorGUI.SelectableLabel (Rect position, System.String text, UnityEngine.GUIStyle style)
UnityEditor.EditorGUILayout.SelectableLabel (System.String text, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[ ] options)
UnityEditor.ConsoleWindow.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture)

plzz help if you do not want to help plzzz dont say anything bad im still new to coding its hard for me:P:hushed::p:smile:

Error Line 125: Your distance is a Vector3 datatype, you can’t compare it against a float.
Error Line 174: See above.
Error Line 204: It’s Vector3.Distance, not Vector3.distance
Error Line 206: Your targets is a List, you need to grab a element in that List before you call .transform. For example

myList[0].transform.position = newPosition; // Passes Vector3 newPosition into the first element of the list of game objects

Error Line 210: See above.

ArgumentOutOfRangeException error is telling you that you are trying to access the array with an index number that is probably less than zero or more than the total length of your array.

ok soo thanks for the help but it gave me more questions then answers but i can work with it atles i can work with something different now and might be better for me ill see if i can fix it ty if anybody else can tell me why am i getting this ArgumentOutOfRangeException error is telling you that you are trying to access an index number that is probably less than zero or more than the total length of your array that be nice i checked and nothing is trying to access under 0 i think but thanks wolf hunter777 ill do my best on this