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); } } } } } }
/// <summary> /// Removes all event listeners for this thing from Actium. /// </summary> public void RemoveAllListeners() { foreach (var link in linksToHandlers) { Actium.RemoveOn(link.name, link.handler); } linksToHandlers.Clear(); }
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); }
protected override void OnEnable() { base.OnEnable(); Actium.On("FlashLightIsPickedUp", OnSolve); }
protected override void OnEnable() { base.OnEnable(); Actium.On("ViveHandInteractsWith_" + gameObject.name, OnInteractionStart); }
public override void OnInteractionStart(object sender) { base.OnInteractionStart(sender); Actium.Dispatch("RequestMovementToFloor", targetFloor); }
void CmdDispatchOnServer(string eventName, object sender) { Actium.Dispatch(eventName, sender); }
public void Dispatch(string eventName, object sender = null) { Actium.Dispatch(eventName, sender); }
/// <summary> /// Set up an event listener in Actium. /// </summary> /// <param name="eventName">Event name.</param> /// <param name="handler">Event handler.</param> public void On(string eventName, ActiumEventHandler handler) { Actium.On(eventName, handler); linksToHandlers.Add(new LinkToHandlerInActiumEventData(eventName, handler)); }
public override void OnPickUp(object sender) { base.OnPickUp(sender); Actium.Dispatch("FlashLightIsPickedUp", sender); }
protected override void OnEnable() { base.OnEnable(); Actium.On("RequestMovementToFloor", Elevate); }