/// <summary> /// If a new target entered the trigger zone and one of our desired targets recently has been dropped, /// the AreWeThereYet method is called to check if all desired targets are in the destination zone. /// </summary> private void AreWeThereYet() { bool areAllObjsInZone = true; // Check that each requested target is within the trigger zone. // Note, this does not check whether additional items have been placed in our trigger zone. for (int i = 0; i < ObjsToPlaceHere.Length; i++) { if ((ObjsToPlaceHere[i] != null) && (!currCollidingObjs.Contains(ObjsToPlaceHere[i].name))) { areAllObjsInZone = false; break; } } // Only change color if the status has changed if (areAllObjsInZone && !prevAllObjsInZone) { EyeTrackingDemoUtils.GameObject_ChangeColor(gameObject, statusColor_achieved, ref originalColor, false); AudioFeedbackPlayer.Instance.PlaySound(AudioFx_Success); } else if (!areAllObjsInZone && prevAllObjsInZone) { EyeTrackingDemoUtils.GameObject_ChangeColor(gameObject, statusColor_idle, ref originalColor, false); } prevAllObjsInZone = areAllObjsInZone; }
private void Start() { // Init our list of currently colliding game objects currCollidingObjs = new List <string>(); // Set default color EyeTrackingDemoUtils.GameObject_ChangeColor(gameObject, statusColor_idle, ref originalColor, false); }