コード例 #1
0
    void Awake()
    {
        this.HandControllerObject    = GameObject.FindWithTag("LeapController");
        this.HandControllerReference = this.HandControllerObject.GetComponent <ExperimentHandController>();

        GameObject rangeCheckContainer = GameObject.FindGameObjectWithTag("RangeCheck");

        this.RangeCheck = rangeCheckContainer.GetComponent <EffectorRangeCheck>();
        this.RangeCheck.ObjectLeftBounds += this.rangeCheckHandler;
        GameObject posecontrollerContainer = GameObject.FindGameObjectWithTag("PoseController");

        this.HandPoseController = posecontrollerContainer.GetComponent <PoseController>();

        // register container controller
        GameObject container = GameObject.FindGameObjectWithTag("Container");

        if (container != null)
        {
            ContainerController containerController = container.GetComponent <ContainerController>();
            if (containerController != null)
            {
                //containerController.ObjectWasReleased += new ContainerController.ObjectWasReleasedHandler(this.checkTargetPosition);
                containerController.ObjectWasReleased  += this.checkTargetPosition;
                containerController.ObjectWasDestroyed += this.checkTargetDestruction;
            }
        }

        this.Target.SetActive(true);
        this.Target.transform.position = new Vector3(0, -100, 100);
        this.Target.GetComponent <Rigidbody>().isKinematic = true;

        this.FixationObject      = GameObject.FindGameObjectWithTag("FixationObject");
        this.TrialUpdateDelegate = delegate() { this.TrialUpdate(); };

        //setup trial control
        this.CurrentTrialState            = new TrainingStateObject();
        this.CurrentTrialState.TrialState = TrainingStates.STARTUP;

        // register listeners
        SliderFocusHandler.SliderEvent    += this.handleSlider;
        CheckMarkFocusHandler.ToggleEvent += this.handleToggle;

        if (GraspTrainingController.Verbose)
        {
            UnityEngine.Debug.Log("done with awaking...");
        }

        this.OffsetController.ApplyDrift = false;
        this.TrainingUI.SetActive(false);
    }
コード例 #2
0
    void Awake()
    {
        this.HandControllerObject    = GameObject.FindWithTag("LeapController");
        this.HandControllerReference = this.HandControllerObject.GetComponent <ExperimentHandController>();
        if (!this.VibroTactileStimulation)
        {
            this.HandControllerReference.enableFingerParticleSystems = true;
        }
        GameObject posecontrollerContainer = GameObject.FindGameObjectWithTag("PoseController");

        this.HandPoseController = posecontrollerContainer.GetComponent <PoseController>();

        this.Target.SetActive(true);
        this.Target.transform.position = new Vector3(0, -100, 100);
        this.Target.GetComponent <Rigidbody>().isKinematic = true;

        this.leftLight  = GameObject.FindGameObjectWithTag("LeftLightStimulus");
        this.rightLight = GameObject.FindGameObjectWithTag("RightLightStimulus");
        this.leftLight.GetComponent <ParticleSystem>().Stop();
        this.leftLight.GetComponent <ParticleSystem>().Clear();
        this.rightLight.GetComponent <ParticleSystem>().Stop();
        this.rightLight.GetComponent <ParticleSystem>().Clear();

        this.messageObtained = false;


        //utils
        this.FixationObject      = GameObject.FindGameObjectWithTag("FixationObject");
        this.TrialUpdateDelegate = delegate() { this.TrialUpdate(); };

        //setup trial control
        this.CurrentTrialState            = new TrainingStateObject();
        this.CurrentTrialState.TrialState = TrainingStates.STARTUP;
        this.LastErrorCode = "none";

        // instruction
        this.FeedbackDisplay.text = "";

        if (SpeechTrainingController.Verbose)
        {
            UnityEngine.Debug.Log("done with awaking...");
        }
    }