Passing from a gameobject to another gameobjects script.

Hello this is my first post and I am new to unity and c sharp.

I have multiple gameobjects (B1,B2…B16) which are identical.
This is the script attached to them:

using UnityEngine;
using System.Collections;

public class MotionDetector : MonoBehaviour {

public  int k;

// Use this for initialization
void Start () {
	k=0;

}

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

}

public void OnMouseUp() {   
	
switch(k)
	{
	case(0):
	  animation.Play("0to1");
	  k++;
	  break;
	case(1):
	  animation.Play("1to2");
	  k++;
	  break;
	case(2):
	  animation.Play("2to3");
	  k++;
	  break;
	case(3):
	  animation.Play("3to4");
	  k++;
	  break;
	case(4):
	  animation.Play("4to0");
	  k=0;
	  break;
	}	

}		

}

I want in another script on a empty gameobject to check the values of the gameobjects (B1 to B16)
I can’t use static, cause all the gameobjects use the same variable k.

I need to call each gameobject value of k and store it.
I tried declaring
GameObject B1=GameObject.Find(“B1”);
.
.
.
GameObject B16=GameObject.Find(“B16”);

and later in the Update function I want to check if gameobject has been clicked 3 times

if (B2.getcomponent.k??? i dont know how to get the value from it ==3)
do something

Any help would be greatly appreciated.
Many thanks,
Dimitris

// C#
MotionDetector myObjects;

void Start()
{
    myObjects = new MotionDetector[16]; // new array with 16 elements ( 0..15 )
    for (int i = 0; i < myObjects.length; i++)
    {
        GameObject go = GameObject.Find("B"+ (i+1));
        if (go != null)
            myObjects *= go.GetComponent<MotionDetector>();*

}
}
Later just use:
myObjects[0].k // B1
myObjects[4].k // B5
myObjects[15].k // B16
Keep in mind that when either one of the gameobjects don’t exists or it doesn’t have a MotionDetector script attached, the myObject array field will be null so you can’t access it.