Esempio n. 1
0
        /// <summary>
        /// Ejects the matter object inside the output slot and returns it.
        /// </summary>
        /// <returns>The output matter object or `null` if none.</returns>
        private MatterObject TakeOutputObject()
        {
            if (this.outputObjects.Count != 0)
            {
                MatterObject toTake = this.outputObjects[this.outputObjects.Count - 1];
                toTake.EnablePhysics();
                toTake.transform.SetParent(this.transform, false);

                this.contentsUI?.RemoveMatter(toTake.Matter);
                this.outputObjects.RemoveAt(this.outputObjects.Count - 1);
                return(toTake);
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Ejects the last inserted matter object, removes it from the input and returns it.
        /// </summary>
        /// <returns>The last inserted matter object or `null` if none.</returns>
        private MatterObject TakeLastInsertedObject()
        {
            if (this.insertedObjects.Count > 0)
            {
                int          index  = this.insertedObjects.Count - 1;
                MatterObject toTake = this.insertedObjects[index];
                toTake.EnablePhysics();
                toTake.transform.SetParent(this.transform, false);

                this.contentsUI?.RemoveMatter(toTake.Matter);
                this.insertedMatter.RemoveAt(index);
                this.insertedObjects.RemoveAt(index);

                return(toTake);
            }

            return(null);
        }