protected void AddNullMark(int x, int y) { gameManager.playOnAddEmptyMark(); AbstractBehaviorBuilder builder = new EmptyMarkBuilder(); Matrix m = marks(); AbstractBehavior mark = builder.create(gameManager.view()); m.insertMark(x, y, mark); }
protected void createNullMark() { Matrix m = marks(); Random rnd = new Random(); int x = rnd.nextInt(m.columns()); int y = rnd.nextInt(m.rows()); AddNullMark(x, y); }
protected void createBlockMark() { Matrix m = marks(); Random rnd = new Random(); int x = rnd.nextInt(m.columns()); int y = rnd.nextInt(m.rows()); while (!blockMark(x, y)) ; }
protected boolean blockMark(int x, int y) { Matrix m = marks(); BehaviorDelegate mark = (BehaviorDelegate) m.getMark(x, y); if (mark.isDied()) return false; Sprite sprite = new Sprite(ImagesPool.instance(gameManager.view()).getCage(), 1000, 1, 1); ViewsManager viewManager = new SlowViewBehavior(mark, sprite, gameManager.view().gameField()); BlockBehavior b = new BlockBehavior(viewManager, gameManager.view().gameField()); m.insertMark(x, y, b); gameManager.playOnAddBlock(); return true; }