public void Add(Key2D key) { if (!levelShape.Contain(key)) { levelShape.Add(key, Colorizer.Instance.GetColor()); } }
public static void RotateRight(IShape shape) { shape.CheckBounds(); for (int i = shape.minX; i < shape.maxX + 1; i++) { for (int j = shape.minY; j < shape.maxY + 1; j++) { k1 = new Key2D(i, j); k2 = new Key2D(shape.maxX - (j - shape.minY), shape.minY + (i - shape.minX)); if (shape.Contain(k1)) { if (!temp.ContainsKey(k2)) { temp.Add(k2, shape.matrix[k1]); } } } } if (temp.Count > 0) { shape.matrix.Clear(); foreach (var p in temp) { shape.matrix.Add(p.Key, p.Value); } } temp.Clear(); }
public int Drop(int line) { int dropResult = 0; for (int i = minX; i < maxX + 1; i++) { Key2D dKey = new Key2D(i, line); if (matrix.ContainsKey(dKey)) { matrix.Remove(dKey); dropResult++; } } foreach (var pair in matrix) { if (pair.Key.y < line) { Move(pair, 0, 1); } } UpdateMatrix(); return(dropResult); }
public void Add(Shape shape, int addRandomPoints) { levelShape.Add(shape.matrix); levelShape.CheckBounds(); for (int i = 0; i < addRandomPoints; i++) { int rX = Random.Range(levelShape.minX, levelShape.maxX); int rY = Random.Range(levelShape.minY, levelShape.maxY); Key2D k = new Key2D(rX, rY); if (!levelShape.Contain(k)) { levelShape.Add(k, Colorizer.Instance.GetColor()); } } Align(); }
public void Add(Key2D key, Color value) { matrix.Add(key, value); }
public bool Contain(Key2D key) { return(matrix.ContainsKey(key)); }
public void Remove(Key2D key) { levelShape.matrix.Remove(key); }
public KeyColorData(Key2D k, Color c) { key = k; color = new ColorData(c); }