Ejemplo n.º 1
0
 private void OnSliceableDrop(Placeable sliceable, Receivable r, bool inRange)
 {
     if (inRange && !activeMenu)
     {
         droppedBaguette = true;
         HandleProcessingOptions(sliceable as Sliceable);
     }
     else
     {
         sliceable.ReturnToInitialPosition();
     }
 }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        protected virtual void OnTriggerEnter(Collider other)
        {
            if (Occupied)
            {
                return;
            }

            placeable = other.GetComponent <Placeable>();
            if (placeable)
            {
                placeable.NotifyEnterProximity(this);
            }
            if (autoShowVisualCue)
            {
                ShowVisualCue();
            }
        }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        protected virtual void OnTriggerExit(Collider other)
        {
            if (Occupied)
            {
                return;
            }

            if (placeable)
            {
                placeable.NotifyExitProximity(this);
                placeable = null;
                if (visualCue)
                {
                    visualCue.SetActive(false);
                }
            }
            if (infoText)
            {
                infoText.gameObject.SetActive(false);
            }
        }
Ejemplo n.º 6
0
        /// <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();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Added some debug stuff as we're getting different
        /// behaviour on Anrdoid (Oculus Go). Time mute
        /// period is not happening
        /// </summary>
        /// <param name="other"></param>
        private void HandleContact(Component other)
        {
            if (other.name.StartsWith(PLAYER))
            {
                WithinBumpRange = true;

                if (bumpDamage)
                {
                    if (bumpRetriggerDelay != 0f)
                    {
                        if (Time.time - timeSinceLastDamage < bumpRetriggerDelay)
                        {
                            Debug.Log("Hazard: Bumped during mute period");

                            return;
                        }
                        else
                        {
                            timeSinceLastDamage = Time.time;
                        }
                    }

                    if (collisionSound)
                    {
                        if (collisionSoundPlayer)
                        {
                            collisionSoundPlayer.PlayOneShot(collisionSound);
                        }
                        else
                        {
                            if (positionalImpactSound)
                            {
                                LeanAudio.play(collisionSound, transform.position);
                            }
                            else
                            {
                                LeanAudio.play(collisionSound);
                            }
                        }
                    }

                    if (animator)
                    {
                        animator.SetTrigger(damageTriggerName);
                    }

                    cumulativeHarm += effectStrength;

                    if (callOnBump != null)
                    {
                        Debug.Log("Hazard: CallOnBump");

                        callOnBump(this);
                    }

                    if (callOnDamage != null)
                    {
                        Debug.Log("Hazard - bump: CallOnDamage");

                        callOnDamage(this, effectStrength);
                    }
                }
                else
                {
                    isWithin = true;
                }
            }
            else
            {
                Placeable placeable = other.GetComponent <Placeable>();
                if (placeable)
                {
                    Debug.Log("COLLISION with placeable " + other.name);

                    if (placeable.CallOnEnterHazard != null)
                    {
                        placeable.CallOnEnterHazard(placeable, this);
                    }
                }
            }
        }
Ejemplo n.º 8
0
 private void OnPourDrop(Placeable placeable, Receivable r, bool inRange)
 {
     placeable.ReturnToInitialPosition();
 }
Ejemplo n.º 9
0
        private void OnExitZone(Placeable p, Receivable r)
        {
            Debug.Log("OnExitZone");

            dialHandler.Show(false);
        }