//パターンを配置 public void SetPattern( ModelBlock[][] model, Pattern pattern, int chain, int x, int y, int dir ){ object[,] data = pattern.Data; for( int i = 0; i < pattern.Width; i++ ){ for( int j = 0; j < pattern.Height; j++ ){ object cell = data[j,i]; int mx = x + i * dir; int my = y + pattern.Height - j - 1; if( cell is int ){ int num = chain + (int)cell; model[mx][my] = new ModelBlock(IDCount++, mx, my, num, num, false, pattern.ScoreRate); }else if( cell == ChainConfig.E ){ model[mx][my] = new ModelBlock(IDCount++, mx, my, -1, int.MaxValue, true, 1, 0 ); }else if( cell is int[] ){ int[] nums = cell as int[]; model[mx][my] = new ModelBlock(IDCount++, mx, my, nums[0], nums[2], false, 1, nums[1]); }else{ if( model[mx][my] == null ){ model[mx][my] = new ModelBlock(IDCount++, mx, my, -1, int.MaxValue, false, pattern.ScoreRate); }else{ if( model[mx][my].ScoreRate < pattern.ScoreRate ) model[mx][my].ScoreRate = pattern.ScoreRate; } } } } }
public ChainFactory( Pattern tail, Pattern body, Pattern joint, Pattern head, int wall = 0, Pattern jointLeft = null ){ Tail = tail; Body = body; Joint = joint; Head = head; Wall = wall; JointLeft = jointLeft; }