Ensure a character not stay without moving within specific area for more than 5 seconds

This code is to ensure test two conditions:

  1. User must be within the trigger region
  2. User must not be stationary for 5 seconds (user must move)
using UnityEngine;
using System.Collections;

public class NoMoveTrigger : MonoBehaviour {

    float elapsedTime; 

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }

    void OnTriggerStay(Collider other){
        if(other.gameObject.CompareTag("Player")){
            CharacterController controller = other.gameObject.GetComponent<CharacterController>();
            //Timer will start when player stopped moving, reset when it moves
            if(controller.velocity == Vector3.zero){
                elapsedTime += Time.deltaTime;
                Debug.Log ("The elapsed time is: " + elapsedTime);
                Debug.Log ("The velocity change is: " + controller.velocity);
                if(elapsedTime >= 5){
                    Debug.Log("You have overstayed!!");
                }
            }
        }
    }
    void OnTriggerExit(Collider other) {
        if(other.gameObject.CompareTag("Player")){
            elapsedTime = 0;
        }
    }
}