void Update()
    {
        var device = SteamVR_Controller.Input(index);

        /*
         * foreach (var buttonId in buttonIds)
         * {
         *  if (SteamVR_Controller.Input(index).GetPressDown(buttonId))
         *  {
         *
         *  }
         *  if (SteamVR_Controller.Input(index).GetPressUp(buttonId))
         *  {
         *
         *  }
         *  if (SteamVR_Controller.Input(index).GetPress(buttonId))
         *  {
         *
         *  }
         * }
         */

        foreach (var buttonId in axisIds)
        {
            if (SteamVR_Controller.Input(index).GetTouchDown(buttonId))
            {
                //Debug.Log(buttonId + " touch down");
            }
            if (SteamVR_Controller.Input(index).GetTouchUp(buttonId))
            {
                if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger)
                {
                    DropItem(device);
                }
            }
            if (SteamVR_Controller.Input(index).GetTouch(buttonId))
            {
                var axis = SteamVR_Controller.Input(index).GetAxis(buttonId);

                if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger)
                {
                    if (itemInHand == null && axis.x >= grabThreshold && GetComponentInChildren <GrabTrigger>().things.Count > 0)
                    {
                        var thing = GetComponentInChildren <GrabTrigger>().things[0];
                        var item  = thing as ObtainableItem;

                        if (item != null)
                        {
                            itemInHand = item;
                            itemInHand.Dispatch(ObtainableItemEventType.OnPickUp, this);
                        }
                        else
                        {
                            Actium.Dispatch("ViveHandInteractsWith_" + thing.name, this);
                        }
                    }
                }
            }
        }
    }
Exemple #2
0
    public void RpcDispatch(string eventName, object sender, NetworkInstanceId[] excludeNetId)
    {
        // Don't dispatch events that are not intendet for certain NetworkClientActium.netIds

        /*
         * if (Array.Find<NetworkInstanceId>(excludeNetId, enetId => enetId == Client.netId) != null)
         * {
         *  return;
         * }
         */

        if (excludeNetId != null && excludeNetId[0] == Client.netId)
        {
            return;
        }

        //Debug.Log(eventName + " BY NetId" + excludeNetId[0]);

        Actium.Dispatch(eventName, sender);
    }
    public override void OnInteractionStart(object sender)
    {
        base.OnInteractionStart(sender);

        Actium.Dispatch("RequestMovementToFloor", targetFloor);
    }
 void CmdDispatchOnServer(string eventName, object sender)
 {
     Actium.Dispatch(eventName, sender);
 }
Exemple #5
0
 public void Dispatch(string eventName, object sender = null)
 {
     Actium.Dispatch(eventName, sender);
 }
    public override void OnPickUp(object sender)
    {
        base.OnPickUp(sender);

        Actium.Dispatch("FlashLightIsPickedUp", sender);
    }