public static brick[] CreateBricks() { brick[] bricks = new brick[40]; for (int i = 0; i < bricks.Length; i++) { bricks[i].x = (byte)((i % 10) * 4); bricks[i].y = (byte)(2 + (i / 10)); bricks[i].destroyed = false; if (i >= 14 && i <= 15) { bricks[i].numberOfHits = 2; bricks[i].color = ConsoleColor.Yellow; bricks[i].score = 50; } else if (i % 2 == 0 && (i / 10) % 2 == 0 || i % 2 == 1 && (i / 10) % 2 == 1) { bricks[i].numberOfHits = 1; bricks[i].color = ConsoleColor.Blue; bricks[i].score = 20; } else { bricks[i].numberOfHits = 1; bricks[i].color = ConsoleColor.Red; bricks[i].score = 10; } } return(bricks); }
void createBricks() { // Create an array inside an array arrayOfBricks = new brick[columns, rows]; // creat a cursor that will move after every instatiate Vector3 cursor = new Vector3(); for (int i = 0; i < columns; i++) { for (int j = 0; j < rows; j++) { //STAMP, Instatiate brick, set the parent to the brick generator, establish where cursor is brick currentBrick = new brick(); currentBrick.gameObject = GameObject.Instantiate(brickPrefab); currentBrick.gameObject.transform.SetParent(transform); currentBrick.gameObject.transform.localPosition = cursor; // Assign all that mess to the array inside the array, I think arrayOfBricks[i, j] = currentBrick; // move the cursor along y axis cursor.y -= padding; //makes a grid with huge padding which sucks //Instantiate(brickPrefab, new Vector3(x, y, 0), Quaternion.identity); */ } // keeps cursor still along y axis, does x axis instead cursor.y = 0; cursor.x += padding; } }
public BrickData(int maxHealthToSet, int idToSet, brick assocBlockToSet, GameManager gmToSet) { maxHealth = maxHealthToSet; currHealth = maxHealth; id = idToSet; assocBlock = assocBlockToSet; assocBlock.gameObject.name = id.ToString(); assocBlock.currManager = gmToSet; }
/// <summary> /// Add new brick to database. /// </summary> /// <param name="brick">new brick instance.</param> public void AddNewBrick(brick brick) { this.brickRepo.Addnew(brick); }
public void SetUp() { this.testDrills = new List <drill>() { new drill() { drill_id = 1, drill_fuel = 3, drill_score = 11, drill_speed = 20, drill_storage = 10, drill_x = 3, drill_y = 3 }, new drill() { drill_id = 2, drill_fuel = 4, drill_score = 12, drill_speed = 21, drill_storage = 11, drill_x = 4, drill_y = 5 }, new drill() { drill_id = 3, drill_fuel = 5, drill_score = 13, drill_speed = 22, drill_storage = 12, drill_x = 6, drill_y = 6 }, new drill() { drill_id = 4, drill_fuel = 6, drill_score = 14, drill_speed = 23, drill_storage = 13, drill_x = 14, drill_y = 13 }, new drill() { drill_id = 5, drill_fuel = 7, drill_score = 15, drill_speed = 25, drill_storage = 17, drill_x = 15, drill_y = 12 }, }; this.testBricks = new List <brick>() { new brick() { brick_id = 1, brick_type = "gold", brick_x = 10, brick_y = 10 }, new brick() { brick_id = 2, brick_type = "silver", brick_x = 15, brick_y = 22 }, new brick() { brick_id = 3, brick_type = "bronze", brick_x = 24, brick_y = 11 }, new brick() { brick_id = 4, brick_type = "gold", brick_x = 16, brick_y = 24 }, new brick() { brick_id = 5, brick_type = "silver", brick_x = 11, brick_y = 34 }, }; this.testConnections = new List <conn>() { new conn() { conn_id = 1, conn_drill_id = 1, conn_brick_id = 1 }, new conn() { conn_id = 2, conn_drill_id = 2, conn_brick_id = 2 }, new conn() { conn_id = 3, conn_drill_id = 3, conn_brick_id = 3 }, new conn() { conn_id = 4, conn_drill_id = 4, conn_brick_id = 4 }, new conn() { conn_id = 5, conn_drill_id = 5, conn_brick_id = 5 }, }; this.testDrill = new drill() { drill_id = 2, drill_fuel = 3, drill_score = 10, drill_speed = 20, drill_storage = 10, drill_x = 3, drill_y = 3 }; this.testBrick = new brick() { brick_id = 2, brick_type = "gold", brick_x = 5, brick_y = 6 }; this.testConn = new conn() { conn_id = 1, conn_brick_id = 2, conn_drill_id = 2 }; this.drillRepo = new Mock <IDrillRepository>(MockBehavior.Loose); this.drillRepo.Setup(c => c.GetAll()).Returns(this.testDrills.AsQueryable()); this.brickRepo = new Mock <IBrickRepository>(MockBehavior.Loose); this.brickRepo.Setup(c => c.GetAll()).Returns(this.testBricks.AsQueryable()); this.connRepo = new Mock <IConnRepository>(MockBehavior.Loose); this.connRepo.Setup(c => c.GetAll()).Returns(this.testConnections.AsQueryable()); this.gameModel = new GameModel(500, 500); this.dbLogic = new DbLogic(this.gameModel, this.drillRepo.Object, this.brickRepo.Object, this.connRepo.Object); }
void colorBlocks() { brick paintedBrick = new brick(); Material paintedMat = paintedBrick.GetComponentInChildren <Renderer>().material; }