示例#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()
    {
        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  += 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.InteractionStateUpdateDelegate = delegate() { this.InteractionStateUpdate(); };

        //setup interaction control
        this.CurrentInteractionState = new InteractionStateObject();
        this.CurrentInteractionState.InteractionStage = InteractionStage.STARTUP;

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