コード例 #1
0
        public void ApplyData_MultipleChildSketchObjects()
        {
            SketchObjectGroup newGroup = GameObject.Instantiate(this.Group);

            this.Group.AddToGroup(this.Ribbon);
            this.Group.AddToGroup(this.Patch);
            this.Group.AddToGroup(this.Stroke);

            SketchObjectGroupData data = (this.Group as ISerializableComponent).GetData() as SketchObjectGroupData;

            (newGroup as ISerializableComponent).ApplyData(data);

            Assert.AreEqual(3, newGroup.transform.childCount);
            Assert.AreEqual(1, newGroup.GetComponentsInChildren <RibbonSketchObject>().Length);
            Assert.AreEqual(1, newGroup.GetComponentsInChildren <StrokeSketchObject>().Length);
            Assert.AreEqual(1, newGroup.GetComponentsInChildren <PatchSketchObject>().Length);
        }
コード例 #2
0
        public void ApplyData_ChildGroup()
        {
            SketchObjectGroup newGroup    = GameObject.Instantiate(this.Group);
            SketchObjectGroup targetGroup = GameObject.Instantiate(this.Group);

            this.Group.AddToGroup(newGroup);

            SerializableComponentData data = (this.Group as ISerializableComponent).GetData();

            (targetGroup as ISerializableComponent).ApplyData(data);

            Assert.AreEqual(1, targetGroup.transform.childCount);
            Assert.AreEqual(2, targetGroup.GetComponentsInChildren <SketchObjectGroup>().Length);
        }