Esempio n. 1
0
    private void ViveBridge_MenuUnclicked(object sender, ClickedEventArgs e)
    {
        switch (ViveBridge.InteractionMode)
        {
        case InteractionMode.SpawnPrimitives:
            if (isLocalPlayer)
            {
                lastCollided = string.Empty;
                primitiveManager.RemoveLastBox();
                if (primitiveManager.IndicatorCount == 0)
                {
                    RpcClearPointsText();
                }
            }
            break;

        case InteractionMode.SpawnObjects:
            if (isLocalPlayer)
            {
                string last      = boxObject.Keys.Last();
                var    childName = GameObject.Find(last).transform.GetChild(0).name;
                DisplayBox(childName, true);
                radialMenu.RemoveLastObject();
                boxObject.Remove(last);
            }
            break;

        case InteractionMode.ScalePrefabs:
            if (!string.IsNullOrEmpty(ViveBridge.CollidedName))
            {
                var collided = GameObject.Find(ViveBridge.CollidedName);
                if (collided.transform.parent != null)
                {
                    collided = collided.transform.parent.gameObject;
                }

                collided.transform.localScale = collided.GetComponent <ScaleData>().WorldScale;
                RpcRestoreScale(collided);
            }
            break;
        }
    }
Esempio n. 2
0
        private void ViveRightController_MenuButtonUnclicked(object sender, ClickedEventArgs clickedEventArgs)
        {
            switch (ViveBridge.InteractionMode)
            {
            case InteractionMode.SpawnPrimitives:
                lastCollided = string.Empty;
                primitiveManager.RemoveLastBox();
                if (primitiveManager.IndicatorCount == 0)
                {
                    ViveBridge.IndicatorCount = 0;
                    UpdateTextMesh();
                }
                break;

            case InteractionMode.SpawnObjects:
                string last      = boxObject.Keys.Last();
                var    childName = GameObject.Find(last).transform.GetChild(0).name;
                DisplayBox(childName, true);
                radialMenu.RemoveLastObject();
                boxObject.Remove(last);
                break;

            case InteractionMode.ScalePrefabs:
                if (!string.IsNullOrEmpty(ViveBridge.CollidedName))
                {
                    var collided = GameObject.Find(ViveBridge.CollidedName);
                    if (collided.transform.parent != null)
                    {
                        collided = collided.transform.parent.gameObject;
                    }

                    collided.transform.localScale = collided.GetComponent <ScaleData>().WorldScale;
                }
                break;
            }
        }