private double CalculateROC(GameObject ref1, GameObject ref2) { movement ref1script = ref1.GetComponent <movement>(); movement ref2script = ref2.GetComponent <movement>(); double speed1 = ref1script.GetCurrentSpeed(); double speed2 = ref2script.GetCurrentSpeed(); return(speed1 - speed2); }