public override void makeGame(int size) { for (int i = size; i > 0; i--) { for (int j = 0; j < size; j++) { SquareBox boxCreation = new SquareBox(); boxCreation.setX(j); boxCreation.setY(i); Debug.Log(boxCreation); lista.Add(boxCreation); } } //assignNeighbour(); //pintor.pintarBoxes( lista ); }
private void boxingButton_Click(object sender, EventArgs e) { boxingListBox.Items.Add("Creating box..."); Box box = new Box(5, 10, 15); boxingListBox.Items.Add("Cloning box as newBox..."); Box newBox = box.Clone(); boxingListBox.Items.Add("Do box and newBox reference same object? " + ReferenceEquals(box, newBox)); boxingListBox.Items.Add("Setting box to null..."); box = null; boxingListBox.Items.Add("Is box null? " + (box == null)); boxingListBox.Items.Add("Is newBox null? " + (newBox == null)); boxingListBox.Items.Add("Volume : " + newBox.Volume()); boxingListBox.Items.Add(""); boxingListBox.Items.Add("Creating squareBox..."); SquareBox squareBox = new SquareBox(20); // Additional Project code squareBox.Dimension = 25; int numberOfDimensions = SquareBox.Dimensions; string volumeCalculation = SquareBox.VolumeCalcuation(); // end SquareBox newSquareBox = squareBox.Reference(); boxingListBox.Items.Add("Do squareBox and newSquareBox reference same object? " + ReferenceEquals(squareBox, newSquareBox)); boxingListBox.Items.Add("Setting squareBox to null..."); squareBox = null; boxingListBox.Items.Add("Is squarebox null? " + (squareBox == null)); boxingListBox.Items.Add("Is newSquareBox null? " + (newSquareBox == null)); // Additional Project code boxingListBox.Items.Add("Are the dimensions equal to 25? " + (numberOfDimensions == 25) + " Actual: " + numberOfDimensions); boxingListBox.Items.Add("What is the formula used for volume? " + volumeCalculation); // End boxingListBox.Items.Add(""); //Sphere code boxingListBox.Items.Add("Creating sphere..."); Sphere sphere = new Sphere(5); boxingListBox.Items.Add("Cloning sphere as newSphere..."); Sphere newSphere = sphere.Clone(); boxingListBox.Items.Add("do sphere and newSphere reference same object? " + ReferenceEquals(sphere, newSphere)); boxingListBox.Items.Add("Setting sphere to null..."); sphere = null; boxingListBox.Items.Add("Is sphere null? " + (sphere == null)); boxingListBox.Items.Add("Is newSphere null? " + (newSphere == null)); boxingListBox.Items.Add("Volume: " + newSphere.Volume()); boxingListBox.Items.Add("What formula is used for sphere volume calculation? " + Sphere.SphereVolumeCalcuation()); }