Ejemplo n.º 1
0
        public void SetIsPlacedFlagTest()
        {
            Block      anchor = new Block(100, 100);
            DummyShape shape  = new DummyShape(anchor, defaultOri);

            shape.GameShapePlaced();

            Assert.AreEqual(true, shape.isPlaced);
        }
Ejemplo n.º 2
0
        private DummyShape BasicShapeInitialize(out List <Vector2> coordinates, ShapeRenderer.Orientation ori)
        {
            Block      anchor = new Block(100, 100);
            DummyShape shape  = new DummyShape(anchor, ori);

            coordinates = new List <Vector2>();
            foreach (Block b in shape.blocks)
            {
                coordinates.Add(new Vector2(b.GetX(), b.GetY()));
            }

            return(shape);
        }
Ejemplo n.º 3
0
        public void SetIsAboutToPlaceFlagTest()
        {
            Block      anchor = new Block(100, 100);
            DummyShape shape  = new DummyShape(anchor, defaultOri);

            shape.AboutToPlaceGameShape();

            Assert.AreEqual(true, shape.isAboutToPlace);

            shape.ResetAboutToPlaceFlag();

            Assert.AreEqual(false, shape.isAboutToPlace);
        }
Ejemplo n.º 4
0
        void Start()
        {
            // create dummy shape
            dummyShape = new DummyShape();

            // create commands
            removeSourceCommand = new DelegateCommand(RemoveSource, () => currentShape != null);
            setCircleCommand    = new DelegateCommand(() => SetSource(ShapeType.Circle));
            setRectangleCommand = new DelegateCommand(() => SetSource(ShapeType.Rectangle));
            setTriangleCommand  = new DelegateCommand(() => SetSource(ShapeType.Triangle));

            BindingManager.Instance.AddSource(this, typeof(BindableClassExample).Name);
        }
Ejemplo n.º 5
0
        public void GetNextOrientationTest()
        {
            Block      anchor = new Block(100, 100);
            DummyShape shape1 = new DummyShape(anchor, ShapeRenderer.Orientation.ORIENT_0);

            DummyShape shape2 = new DummyShape(anchor, ShapeRenderer.Orientation.ORIENT_1);

            DummyShape shape3 = new DummyShape(anchor, ShapeRenderer.Orientation.ORIENT_2);

            DummyShape shape4 = new DummyShape(anchor, ShapeRenderer.Orientation.ORIENT_3);

            Assert.AreEqual(ShapeRenderer.Orientation.ORIENT_1, shape1.GetNextOrientation());
            Assert.AreEqual(ShapeRenderer.Orientation.ORIENT_2, shape2.GetNextOrientation());
            Assert.AreEqual(ShapeRenderer.Orientation.ORIENT_3, shape3.GetNextOrientation());
            Assert.AreEqual(ShapeRenderer.Orientation.ORIENT_0, shape4.GetNextOrientation());
        }
Ejemplo n.º 6
0
        public void GameShapeTest()
        {
            Vector2        expectedCoordinate = new Vector2(100, 100);
            Block          anchor             = new Block((int)expectedCoordinate.X, (int)expectedCoordinate.Y);
            DummyShape     shape       = new DummyShape(anchor, defaultOri);
            List <Vector2> coordinates = new List <Vector2>();

            foreach (Block b in shape.blocks)
            {
                coordinates.Add(new Vector2(b.GetX(), b.GetY()));
            }

            // Ensure anchor set
            Assert.AreEqual(anchor, shape.GetBlocks().ElementAt(0));
            // Ensure color set to RED
            Assert.AreEqual(DrawColor.Shade.COLOR_GREY, shape.GetColor());
            // Ensure orientation set
            Assert.AreEqual(defaultOri, shape.GetOrientation());
            // Ensure other blocks are added correctly (correct coordinates)
            Assert.AreEqual(expectedCoordinate, coordinates.ElementAt(0));
        }