How to fix (does not exist in the current context)

Can you help me

using UnityEngine;
using System.Collections;

public class EnemyController : MonoBehaviour{
	NavMeshAgent nav;
	Transform player;
	Animator controller;
	float health;
	GameManagement game;
	CapsuleCollider capsuleCollider;
	Animator anim;
	bool isDead = false;
	int pointValue = 10;

	public float timeToAttack;

	void Awake(){
		nav = GetComponent <NavMeshAgent> ();
		player = GameObject.FindGameObjectWithTag ("player").transform;
		controller = GetComponentInParent<Animator> ();
		game = FindObjectOfType<GameManagement> ();
		health = 20 + (1.25f * game.round);
		capsuleCollider = GetComponent <CapsuleCollider> ();
		anim = GetComponent <Animator> ();
	}

	void Update (){
		if (!isDead) 
		{
			nav.SetDestination (player.position);
			float distance = Vector3.Distance(transform.position, player.position);
			if (distance < 3)
			{
				attackTimer += Time.deltaTime;
			}
			else if (attackTimer > 0)
			{
				attackTimer -= Time.deltaTime*2;
			}
			else
				attackTimer = 0;

		}
	}

	bool Attack()
	{
		if (attackTimer > timeToAttack)
		{
			//sound
			attackTimer = 0;
				return true;
		}
		return false;
	}

	void ApplyDamage(float damage)
	{
		health -= damage;
		if (health <=0)
			Death ();
		GameManagement.AddPoints(pointValue);
	}
void Death ()
	{
		isDead = true;
		nav.Stop ();
		capsuleCollider.isTrigger = true;

		anim.SetTrigger ("isDead");
		//GameManagement.score += 10;
		//GameManagement.money += 10;
		//enemyAudio.clip = deathClip;
		//enemyAudio.Play ();

		Destroy (gameObject, 4f);
	}

	void OnCollisionStay(Collision collisionInfo)
	{
		if(collisionInfo.gameObject.tag == "player")
		{
			if(Attack ())
				collisionInfo.collider.MessageUpwards("PlayerDamage", damage, SendMessageOptions.Rect);	
		}
}
}

Here is a list of your current fields that the methods like Attack, ApplyDamage, etc have scope to in the class:

     NavMeshAgent nav;
     Transform player;
     Animator controller;
     float health;
     GameManagement game;
     CapsuleCollider capsuleCollider;
     Animator anim;
     bool isDead = false;
     int pointValue = 10;
 
     public float timeToAttack;

You will notice the absence of a field/property called attackTimer. You will need to create that or fix your error if you used the wrong variable that you defined. If attackTimer is a float, put it up there with the rest of the fields.

Secondly:

 collisionInfo.collider.MessageUpwards("PlayerDamage", damage, SendMessageOptions.Rect); 

MessageUpwards is incorrect, you want the method SendMessageUpwards that’s an easy one to remove from the bottom of your errors.

The options is not required. I’m not sure about SendMessageOptions.Rect, but SendMessageOptions.RequireReceiver will print an error if “PlayerDamage” is not picked up by any component.