Exemplo n.º 1
0
        public override void Initialize()
        {
            var data   = JsonUtilities.Deserialize <CardData[]>("Cards.json");
            var random = new Random();

            scene        = new SimpleScene2D();
            scene.Camera = Camera;
            scene.Canvas = Canvas;

            hand  = new Hand(scene);
            board = new Board();

            for (int i = 0; i < 10; i++)
            {
                hand.Add(new Card(data[random.Next(data.Length)], false));
            }

            InputProcessor.Add(full =>
            {
                if (!full.TryGetData(out MouseData mouse))
                {
                    return;
                }

                if (mouse.Query(GLFW.GLFW_MOUSE_BUTTON_LEFT, InputStates.PressedThisFrame))
                {
                    board.PlayerLane.Add(hand.Play(0));
                }
            });
        }
Exemplo n.º 2
0
        public Hand(SimpleScene2D scene)
        {
            this.scene = scene;

            var corner = Resolution.WindowDimensions / 2;

            cards        = new List <Card>();
            basePosition = new vec2(corner.x - 350, corner.y) - Utilities.Direction(BaseAngle) * (Radius * 0.65f);
        }