Пример #1
0
        public GameView(Point viewSize, Point tileSize, Level level)
        {
            ViewSize = viewSize;
            TileSize = tileSize;

            SelectedSprite = new Sprite { BaseAlpha = 0.35F };

            var baseLayer = new Layer
            {
                BackgroundTexture = Assets.GetTexture("background"),
                Size = ViewSize
            };

            AnimalLayer = new Layer();
            baseLayer.AddChild(AnimalLayer);
            AddChild(baseLayer);

            ValidSwapAnimation = new AnimationValidSwap();
            InvalidSwapAnimation = new AnimationInvalidSwap();
            MatchAnimation = new AnimationMatches();
            FallingAnimalsAnimation = new AnimationFallingAnimals();
            NewAnimalsAnimation = new AnimationNewAnimals();

            Level = level;
            Level.ComboMultiplier = 1;
            RefreshLayers();
        }
Пример #2
0
        public Controller(Level level, GameView view)
        {
            View = view;
            Level = level;

            _helpTimerStart = DateTime.Now;

            Restart();
        }
Пример #3
0
        protected override void Initialize()
        {
            base.Initialize();

            var mersenneTwister = new MersenneTwister();

            var loader = new LevelLoader();
            var firstLevel = new Level(loader.Load("Content/first"), mersenneTwister);
            var view = new GameView(new Point(Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight), new Point(64, 64), firstLevel);

            _controller = new Controller(firstLevel, view);
            var input = new MouseInputHandler(_controller, view);
            input.Swap += _controller.SwapAnimals;
        }