Example #1
0
        public void ShowLayer(ShowingLayer layer)
        {
            if (this.showing != layer)
            {
                this.showing = layer;
                if (activeHand != null)
                {
                    SG.Util.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.GetIMURotation());
                    }
                    if (!updateWrist)
                    {
                        activeHand.handAnimation.CalibrateWrist();
                        activeHand.handAnimation.UpdateWrist(activeHand.GetIMURotation());
                    }
                    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);
                    }
                    if (layer == ShowingLayer.GestureLayer)
                    {
                        activeHand.gestureLayer.gameObject.SetActive(true);
                    }
                }
                SetLayerObjects((int)layer, true);
                UpdateOverview(layer);
            }
        }
Example #2
0
 public void UpdateOverview(ShowingLayer layer)
 {
     Debug.Log("Showing " + layer.ToString());
     for (int i = 0; i < this.overviewTexts.Length; i++)
     {
         if (overviewTexts[i] != null)
         {
             Color textColor;
             if (layer == ShowingLayer.All)
             {
                 textColor = this.textHLColor;
             }
             else if (layer == ShowingLayer.None)
             {
                 textColor = this.textDisabledColor;
             }
             else
             {
                 textColor = ((ShowingLayer)i) == layer ? textHLColor : textDisabledColor;
             }
             overviewTexts[i].color = textColor;
         }
     }
 }