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>(); }
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; }
public DestroyAnimation(float _duration, TableCoords _block, GameField.BlockType _type) : base(_duration, _type) { block = _block; }
protected Animation(float _duration, GameField.BlockType _type) { duration = _duration; type = _type; timeElapsed = 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); }
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; }