Пример #1
0
 //Remove from this container a single, a list of, or every child
 //THIS DOES NOT DESTROY THE OBJECT - only the reference.
 void ISignalContainer.RemoveChild(ISignalContent target)
 {
     while (contents.Remove(target))
     {
         ;                                        //execute remove in a loop to ensure every single instance of target is removed
     }
 }
Пример #2
0
 //Insert newEntry object.
 //If a position is given updates child offset. If absolutePosition = false, apply this container’s offset to child position.
 void ISignalContainer.AddChild(ISignalContent newEntry)
 {
     if (newEntry != null)
     {
         contents.Add(newEntry);
     }
     //else { UnityEngine.Debug.LogWarning("Cannot SignalFragment.AddChildAt(null)"); }
 }
Пример #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)"); }
 }
        public void UTSignalFragmentOffset1()
        {
            Assert.AreEqual((new SignalFragment() as ISignalContent).Offset, 0);

            ISignalContent testItem1 = (new SignalFragment(1) as ISignalContent);
            ISignalContent testItem2 = (new SignalFragment(2, null) as ISignalContent);

            Assert.AreEqual(testItem1.Offset, 1);
            Assert.AreEqual(testItem2.Offset, 2);

            testItem1.Offset = 4;
            Assert.AreEqual(testItem1.Offset, 4);
        }