Exemplo n.º 1
0
        // This is the collision system.
        private void OnTriggerEnter(Collider other)
        {
            if (!other.gameObject.CompareTag("Pickup"))
            {
                return;
            }

            GetComponent <AudioSource>().PlayOneShot(other.gameObject.GetComponent <PickupSound>().Sound, 10);
            Destroy(other.gameObject);

            // Tally the number collected per current block
            int BlockID = TrialProgress.GetCurrTrial().BlockID;

            TrialProgress.GetCurrTrial().TrialProgress.NumCollectedPerBlock[BlockID]++;

            TrialProgress.GetCurrTrial().NumCollected++;
            E.LogData(
                TrialProgress.GetCurrTrial().TrialProgress,
                TrialProgress.GetCurrTrial().TrialStartTime,
                transform,
                1
                );

            if (--localQuota > 0)
            {
                return;
            }

            E.Get().CurrTrial.Notify();

            _playingSound = true;
        }
Exemplo n.º 2
0
        private void Update()
        {
            E.LogData(TrialProgress.GetCurrTrial().TrialProgress, TrialProgress.GetCurrTrial().TrialStartTime, transform);

            // Wait for the sound to finish playing before ending the trial
            if (_playingSound)
            {
                if (!GetComponent <AudioSource>().isPlaying)
                {
                    TrialProgress.GetCurrTrial().Progress();
                    _playingSound = false;
                }
            }

            // This first block is for the initial rotation of the character
            if (_currDelay < _waitTime)
            {
                doInitialRotation();
            }
            else
            {
                // This section rotates the camera (potentiall up 15 degrees), basically deprecated code.
                if (!_reset)
                {
                    Cam.transform.Rotate(0, 0, 0);
                    _reset = true;
                    TrialProgress.GetCurrTrial().ResetTime();
                }

                // Move the character.
                try
                {
                    ComputeMovement();
                }
                catch (MissingComponentException e)
                {
                    Debug.LogWarning("Skipping movement calc: instructional trial");
                }
            }

            _currDelay += Time.deltaTime;
        }