private void Awake() { container = GetComponentInParent <Block>(); container.Bind(this); outPin = GetComponentInChildren <Connectable>(); Debug.Assert(outPin, "No Connectable component"); inTab = GetComponentInChildren <Receivable>(); Debug.Assert(inTab, "No Receivable component"); outPin.CallOnClick = CallOnClick; outPin.CallOnRelease = CallOnRelease; outPin.CallOnDrop = CallOnDrop; PinPosition = outPin.transform.position; connectionLine = GetComponent <LineRenderer>(); controlPoints = new Vector3[3]; pointCount = CalcPointsForIterations(iterations); points = new Vector3[pointCount]; buffer = new Vector3[pointCount]; connectionLine.positionCount = pointCount; if (cableWidth != 0f) { connectionLine.startWidth = connectionLine.endWidth = cableWidth; } }
public virtual void NotifyExitProximity(Receivable receivable) { inProximity = false; CallOnExit?.Invoke(this, receivable); lastReceived = null; Debug.Log("ExitProximity " + receivable.name); }
public virtual void NotifyExitCollision(Receivable receivable) { inCollision = false; receivable.SetColliderInfo(info); CallOnCollisionExit?.Invoke(this, receivable); lastReceived = null; Debug.Log("ExitCollision " + receivable.name); }
public virtual void NotifyEnterCollision(Receivable receivable) { inCollision = true; receivable.SetTriggerInfo(info); CallOnCollisionEnter?.Invoke(this, receivable); lastReceived = receivable; Debug.Log("EnterCollision " + receivable.name); }
/// <summary> /// When we're in range of the receivable, /// detected by the receivable's trigger /// </summary> /// <param name="receivable"></param> public virtual void NotifyEnterProximity(Receivable receivable) { inProximity = true; receivable.SetTriggerInfo(info); CallOnEnter?.Invoke(this, receivable); lastReceived = receivable; Debug.Log("EnterProximity " + receivable.name); }
private void OnSliceableDrop(Placeable sliceable, Receivable r, bool inRange) { if (inRange && !activeMenu) { droppedBaguette = true; HandleProcessingOptions(sliceable as Sliceable); } else { sliceable.ReturnToInitialPosition(); } }
private void OnEnterZone(Placeable p, Receivable r) { Debug.Log("OnEnterZone"); Pourable pourable = p as Pourable; if (pourable) { dialHandler.SetMetric(0, pourable.maxUnits, pourable.metric); dialHandler.Set(pourable.PourAccumulator); dialHandler.Show(true); } }
private void OnPlaceableDrop(Placeable placeable, Receivable r, bool inRange) { if (inRange && !activeMenu) { int accum = 1; if (addedItems.ContainsKey(placeable.name)) { accum += addedItems[placeable.name]; } addedItems[placeable.name] = accum; if (ingredientDestination) { placeable.MoveToPosition(ingredientDestination.position); } else { placeable.MoveToReceiverPosition(); } // Only getting single prep step for all eggs, as it seems // redundant to allow seperate preparation for each one if (placeable.name == "Egg" && !prepSteps.ContainsKey("Egg")) { eggPrep.Show(); activeMenu = true; droppedEgg = true; } else if (placeable.name == "Garlic" && !prepSteps.ContainsKey("Garlic")) { garlicPrep.Show(); activeMenu = true; droppedGarlic = true; } else if (placeable.name == "Lettuce leaf" && !prepSteps.ContainsKey("Lettuce leaf")) { lettucePrep.Show(); activeMenu = true; droppedLettuce = true; } } else { placeable.ReturnToInitialPosition(); } }
public override void OnTriggerClickUp(VrEventInfo info) { base.OnTriggerClickUp(info); if (CallOnDrop != null) { CallOnDrop(this, lastReceived, inProximity); } if (returnToHomeIfReleased) { ReturnToInitialPosition(); } if (lastReceived) { lastReceived.SetHighlight(false); lastReceived = null; } }
/// <summary> /// We've asked our outgoing connection pin /// to notify us when it's dropped. We confirm /// it's a Connectable (which should be a given) /// then check if it's dropped on a ConnectionReceiver. /// If so, clear any existing connection from either /// terminal and form a new connection. If it's /// dropped outside of a receiver proximity, /// clear the outgoing connection if any and /// remove connection line. /// </summary> /// <param name="p"></param> /// <param name="r"></param> /// <param name="inProximity"></param> private void CallOnDrop(Placeable p, Receivable r, bool inProximity) { Connectable conn = p as Connectable; if (conn) { Debug.Log("Dropped connector"); ConnectionReceiver receiver = r as ConnectionReceiver; if (receiver && inProximity) { SetConnection(receiver.connection); } else { ClearOutgoingConnection(); } } p.ReturnToInitialPosition(); }
private void OnPourDrop(Placeable placeable, Receivable r, bool inRange) { placeable.ReturnToInitialPosition(); }
private void OnExitZone(Placeable p, Receivable r) { Debug.Log("OnExitZone"); dialHandler.Show(false); }