Пример #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize windowSize = VisibleBoundsWorldspace.Size;

            var move = new CCMoveBy(4, new CCPoint(windowSize.Width / 2, 0));

            backGround.Position   = VisibleBoundsWorldspace.Left();
            backGround.PositionX += windowSize.Width / 4;

            // Run background animation
            backGround.RepeatForever(move, move.Reverse());

            backGround.DrawSolidCircle(CCPoint.Zero, 220, CCColor4B.White);
            AddChild(backGround);


            var color = CCColor4B.Red;
            var alpha = (byte)(255 * 0.3f);

            color.A = alpha;

            // Draw polygons
            //P1: 380:-160 P2: 200:-240 P3: 160:-420
            CCPoint[] points = new CCPoint[]
            {
                //P1: 380:-160 P2: 200:-240 P3: 160:-420
                new CCPoint(380, -160),
                new CCPoint(200, -240),
                new CCPoint(160, -420),
            };

            DrawSolidPolygon(points, color);

            //P1: 160:-420 P2: 200:-520 P3: 360:-540
            points[0] = new CCPoint(160, -420);
            points[1] = new CCPoint(200, -520);
            points[2] = new CCPoint(360, -540);

            DrawSolidPolygon(points, color);

            //P1: 360:-540 P2: 420:-600 P3: 520:-520
            points[0] = new CCPoint(360, -540);
            points[1] = new CCPoint(420, -600);
            points[2] = new CCPoint(530, -520);

            DrawSolidPolygon(points, color);

            //P1: 520:-520 P2: 380:-160 P3: 160:-420
            points[0] = new CCPoint(520, -520);
            points[1] = new CCPoint(380, -160);
            points[2] = new CCPoint(160, -420);

            DrawSolidPolygon(points, color);

            // P1: 160:-420 P2: 360:-540 P3: 520:-520
            points[0] = new CCPoint(160, -420);
            points[1] = new CCPoint(360, -540);
            points[2] = new CCPoint(520, -520);

            DrawSolidPolygon(points, color);

            drawTriangles.Position = windowSize.Center;
            // Offset by the bounds of the polygons to more or less center it
            drawTriangles.PositionX -= 370;
            drawTriangles.PositionY += 440;
        }