Пример #1
0
        public Match3Game()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            curScreen = CurrentScreen.MainMenuScreen;

            IsMouseVisible = true;

            requiredTextures = new string[] {
                "playBtn",
                "playBtnHov",
                "playBtnClicked",
                "okBtn",
                "okBtnHov",
                "okBtnClicked",
                "gameOverDlg",
            };

            textures = new Dictionary<string, Texture2D>();

            field = new GameField(FIELD_SIZE);

            blocksTextures = new Texture2D[(int)GameField.BlockType.BlocksCount * 3];

            runningAnimations = new List<Animation>();
        }
Пример #2
0
 public MoveAnimation(Vector2 _start, Vector2 _shift, float _duration, GameField.BlockType _type, TableCoords _destination)
     : base(_duration, _type)
 {
     start = _start;
     timeElapsed = 0;
     shift = _shift;
     duration = _duration;
     destination = _destination;
     type = _type;
 }
Пример #3
0
 public DestroyAnimation(float _duration, TableCoords _block, GameField.BlockType _type)
     : base(_duration, _type)
 {
     block = _block;
 }
Пример #4
0
 protected Animation(float _duration, GameField.BlockType _type)
 {
     duration = _duration;
     type = _type;
     timeElapsed = 0;
 }
Пример #5
0
        private MoveAnimation createOneDropDownAnimation(Vector2 start, TableCoords destination, GameField.BlockType type)
        {
            float duration = Math.Abs(getBlockCoords(destination).Y - start.Y) / BLOCK_TEXTURE_SIZE / BLOCK_DROP_DOWN_VELOCITY;
            Vector2 shift = new Vector2(0, BLOCK_TEXTURE_SIZE * BLOCK_DROP_DOWN_VELOCITY);

            return new MoveAnimation(start, shift, duration, type, destination);
        }
Пример #6
0
        private int countBlocks(GameField.BlockType type, TableCoords start, TableCoords shift)
        {
            int counter = 0;
            TableCoords pos = start + shift;

            while (type == field.Get(pos))
            {
                ++counter;

                pos += shift;
            }

            return counter;
        }