Beispiel #1
0
        ISignalStack ISignalHandler.GetValuesAt(int position, ISignalStack collectorStack, uint loopLength, bool recursive)
        {
            //propagate a request for all available values at position down to all children then return the collector stack

            //create an empty collectorStack if not available
            if (collectorStack == null)
            {
                collectorStack = new WaveStack();
            }

            //adjust position to this object's offset
            position = SignalHelper.AbsoluteToRelativePosition(position, _offset, loopLength);

            //propagate the call down to every children
            foreach (ISignalContent child in contents)
            {
                //propagate the call only if the object is NOT a container or if recursive is true
                if (recursive || !(child is ISignalContainer))
                {
                    child.GetValuesAt(position, collectorStack, loopLength, recursive);
                }
            }

            return(collectorStack);
        }
Beispiel #2
0
        //return every children with values at target position.
        //if recursive = false will only include immediate children but values will be searched down to every depth
        List <ISignalContent> ISignalContainer.GetChildrenTouching(int position, List <ISignalContent> collectorArray, uint loopLength, bool recursive)
        {
            position = SignalHelper.AbsoluteToRelativePosition(position, _offset, loopLength);

            //ensure collectorArray exists
            if (collectorArray == null)
            {
                collectorArray = new List <ISignalContent>();
            }

            //save immediate children with values in target position
            //also propagate the call if recursive = true
            foreach (ISignalContent child in contents)
            {
                ISignalHandler childHandler = child as ISignalHandler;
                if (child != null && childHandler != null && childHandler.HasValuesAt(position, loopLength, true))
                {
                    collectorArray.Add(child);

                    if (recursive && (child as ISignalContainer) != null)
                    {
                        (child as ISignalContainer).GetChildrenTouching(position, collectorArray, loopLength, true);
                    }
                }
            }

            return(collectorArray);
        }
Beispiel #3
0
 void ISignalContainer.AddChildAt(ISignalContent newEntry, int position, bool absolutePosition)
 {
     if (newEntry != null)
     {
         newEntry.Offset = absolutePosition ? position : SignalHelper.AbsoluteToRelativePosition(position, _offset);
         contents.Add(newEntry);
     }
     //else { UnityEngine.Debug.LogWarning("Cannot SignalFragment.AddChildAt(null)"); }
 }
Beispiel #4
0
        //ENDOF Constructor

        //Implementación ISignalHandler
        bool ISignalHandler.HasValuesAt(int position, uint loopLength, bool recursive)
        {
            position = SignalHelper.AbsoluteToRelativePosition(position, _offset, loopLength);


            foreach (ISignalContent child in contents)
            {
                //propagate the call to every children if recursive = true,
                //only to children who are not containers if recursive = false
                if ((recursive || (child as ISignalContainer) == null) && child.HasValuesAt(position, loopLength, recursive))
                {
                    return(true);
                }
            }

            return(false);
        }