コード例 #1
0
    private void Update()
    {
        if (trainingMode && manipulationInProgress)
        {
            // Calculate distance of manipulated object and gate
            gateScript = ObjectCollectionManager.Instance.GetCreatedGateScript();

            if (gateScript == null || manipulatedObject == null)
            {
                return;
            }

            if (gateScript.objectInsideGate(manipulatedObject))
            {
                if (uiController.greekEnabled)
                {
                    if (!audioSource.isPlaying)
                    {
                        audioSource.Play();
                    }
                }
                else
                {
                    if (!TextToSpeech.Instance.IsSpeaking())
                    {
                        TextToSpeech.Instance.StartSpeaking("Apple inside the Circle");
                    }
                }

                if (!objectInGateDetected)
                {
                    freeToRelease        = false;
                    objectInGateDetected = true;
                    //Reset Timer
                    timer = 0.0f;
                }
                else
                {   //Refresh Timer
                    timer += Time.deltaTime;
                    if (timer > timerForGate)
                    {
                        freeToRelease = true;
                        if (gateScript != null)
                        {
                            gateScript.enableCollider();
                        }
                    }
                }
            }
        }
    }