コード例 #1
0
        public void SetBrushOnRibbonSketchObject()
        {
            ICommand addCommand = new AddPointAndRotationCommand(this.Ribbon, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 45));

            Invoker.ExecuteCommand(addCommand);

            addCommand = new AddPointAndRotationCommand(this.Ribbon, new Vector3(1, 1, 1), Quaternion.Euler(0, 0, -45));
            Invoker.ExecuteCommand(addCommand);

            addCommand = new AddPointAndRotationCommand(this.Ribbon, new Vector3(1, 1, 1), Quaternion.Euler(45, 0, 0));
            Invoker.ExecuteCommand(addCommand);

            Assert.AreEqual(3 * 3, this.Ribbon.GetComponent <MeshFilter>().sharedMesh.vertexCount);

            RibbonBrush brush = this.Ribbon.GetBrush() as RibbonBrush;

            brush.SketchMaterial.AlbedoColor = Color.cyan;
            brush.CrossSectionVertices.Add(Vector3.one);
            ICommand SetBrushCommand = new SetBrushCommand(this.Ribbon, brush);

            Invoker.ExecuteCommand(SetBrushCommand);

            Assert.AreEqual(4 * 3, this.Ribbon.GetComponent <MeshFilter>().sharedMesh.vertexCount);
            Assert.AreEqual(Color.cyan, this.Ribbon.GetComponent <MeshRenderer>().sharedMaterial.color);
            RibbonBrush updatedBrush = this.Ribbon.GetBrush() as RibbonBrush;

            Assert.AreEqual(Color.cyan, updatedBrush.SketchMaterial.AlbedoColor);
        }
コード例 #2
0
        public void AddOneControlPointAndRotationCommandUndo()
        {
            ICommand addCommand = new AddPointAndRotationCommand(this.RibbonSketchObject, new Vector3(0, 0, 0), Quaternion.Euler(45, 0, 0));

            Invoker.ExecuteCommand(addCommand);
            Invoker.Undo();

            Assert.AreEqual(null, RibbonSketchObject.GetComponent <MeshFilter>().sharedMesh);
            Assert.IsTrue(SketchWorld.ActiveSketchWorld.IsObjectDeleted(this.RibbonSketchObject));
        }
コード例 #3
0
        public void AddControlPointAndRotationCommand()
        {
            ICommand addCommand = new AddPointAndRotationCommand(this.RibbonSketchObject, new Vector3(0, 0, 0), Quaternion.Euler(45, 0, 0));

            Invoker.ExecuteCommand(addCommand);

            addCommand = new AddPointAndRotationCommand(this.RibbonSketchObject, new Vector3(1, 0, 0), Quaternion.Euler(-45, 0, 0));
            Invoker.ExecuteCommand(addCommand);

            Assert.AreEqual(6, RibbonSketchObject.GetComponent <MeshFilter>().sharedMesh.vertices.Length);
        }