예제 #1
0
        // Use this for initialization
        void Start()
        {
            prevBtn.gameObject.SetActive(true);
            nextBtn.gameObject.SetActive(true);
            calibrateWristBtn.gameObject.SetActive(false);

            layerObjects = new GameObject[(int)ShowingLayer.All][];
            layerObjects[(int)ShowingLayer.FeedbackLayer]  = this.feedbackObjects;
            layerObjects[(int)ShowingLayer.RigidbodyLayer] = this.rigidBodyObjects;
            layerObjects[(int)ShowingLayer.PhysicsLayer]   = this.physicsObjects;
            layerObjects[(int)ShowingLayer.GrabLayer]      = this.grabLayerObjects;

            SetAllObjects(false);
            GoToStep(0);

            //allow both hands to at least call Awake, then turn them off for now.
            SG_Util.SetChildren(leftHand.transform, true);
            SG_Util.SetChildren(leftHand.transform, false);
            SG_Util.SetChildren(rightHand.transform, true);
            SG_Util.SetChildren(rightHand.transform, false);

            SG_Util.AppendButtonText(prevBtn, "\r\n(" + prevKey.ToString() + ")");
            SG_Util.AppendButtonText(nextBtn, "\r\n(" + nextKey.ToString() + ")");
            SG_Util.AppendButtonText(calibrateWristBtn, "\r\n(" + wristKey.ToString() + ")");
        }
예제 #2
0
        public void ShowLayer(ShowingLayer layer)
        {
            if (this.showing != layer)
            {
                this.showing = layer;
                if (activeHand != null)
                {
                    SG_Util.SetChildren(activeHand.transform, false); //all layers are off
                    SetAllObjects(false);
                    if (layer >= ShowingLayer.None)
                    {
                        activeHand.handModel.gameObject.SetActive(true);
                    }
                    if (layer >= ShowingLayer.AnimationLayer)
                    {
                        activeHand.handAnimation.gameObject.SetActive(true);
                    }
                    activeHand.handModel.DebugEnabled = layer <ShowingLayer.FeedbackLayer && layer> ShowingLayer.None;

                    bool updateWrist = layer >= ShowingLayer.AnimationLayer;

                    if (updateWrist && !activeHand.handAnimation.updateWrist)
                    {
                        activeHand.handAnimation.updateWrist = true;
                        activeHand.handAnimation.CalibrateWrist();
                        activeHand.handAnimation.UpdateWrist(activeHand.hardware.GloveData);
                    }
                    if (!updateWrist)
                    {
                        activeHand.handAnimation.CalibrateWrist();
                        activeHand.handAnimation.UpdateWrist(activeHand.hardware.GloveData);
                    }
                    activeHand.handAnimation.updateWrist = updateWrist;

                    if (layer == ShowingLayer.FeedbackLayer || layer == ShowingLayer.All)
                    {
                        activeHand.feedbackScript.gameObject.SetActive(true);
                    }
                    if (layer == ShowingLayer.GrabLayer || layer == ShowingLayer.All)
                    {
                        activeHand.grabScript.gameObject.SetActive(true);
                    }
                    if (layer == ShowingLayer.RigidbodyLayer || layer == ShowingLayer.All)
                    {
                        activeHand.rigidBodyLayer.gameObject.SetActive(true);
                    }
                    if (layer == ShowingLayer.PhysicsLayer)
                    {
                        activeHand.physicsTrackingLayer.gameObject.SetActive(true);
                    }
                }
                SetLayerObjects((int)layer, true);
                UpdateOverview(layer);
            }
        }
    // Use this for initialization
    void Start()
    {
        SG_Util.SetChildren(leftHand.transform, false);
        SG_Util.SetChildren(rightHand.transform, false);
        if (objectText != null)
        {
            objectText.text = "";
        }
        if (nextButton != null)
        {
            Text btnText = nextButton.GetComponentInChildren <Text>();
            if (btnText != null)
            {
                btnText.text = btnText.text + "\r\n(" + this.nextObjKey.ToString() + ")";
            }
        }
        if (previousButton != null)
        {
            Text btnText = previousButton.GetComponentInChildren <Text>();
            if (btnText != null)
            {
                btnText.text = btnText.text + "\r\n(" + this.prevObjKey.ToString() + ")";
            }
        }
        if (wristButton != null)
        {
            Text btnText = wristButton.GetComponentInChildren <Text>();
            if (btnText != null)
            {
                btnText.text = btnText.text + "\r\n(" + this.calibrateWristKey.ToString() + ")";
            }
        }

        ButtonsActive = false;
        breakables    = new SG_Breakable[ffbObjects.Length];
        for (int i = 0; i < ffbObjects.Length; i++)
        {
            ffbObjects[i].gameObject.SetActive(true); //allows them to call awake at least once.
            breakables[i] = ffbObjects[i].GetComponent <SG_Breakable>();


            ffbObjects[i].gameObject.SetActive(false);
        }
    }