private void OnTriggerEnter(Collider other) { CubeValue cubeValue = other.GetComponent <CubeValue>(); this.scoreManager.increaseScore(cubeValue.getCurrentValue()); Destroy(other.gameObject); }
public bool SetFaceValue(int row, int column, CubeValue cubeValue) { var result = false; _face[row, column] = cubeValue; result = true; return(result); }
public void Init(CubeValue cubeValue) { //initialize with defaults for (int y = 0; y < _face.GetLength(1); y++) { for (int x = 0; x < _face.GetLength(0); x++) { _face[x, y] = cubeValue; } } }
private void OnTriggerEnter(Collider other) { CubeValue cubeValue = other.GetComponent <CubeValue>(); cubeValue.applyMultiplier(this.multiplier); }
public void DoMove(CubeMove move) { int i, j; CubeFace endFace = null; CubeValue planeValue = CubeValue.None; int z = Math.Abs(move.Level - faceMax); switch (move.Plane) { case CubePlane.X: //save before move if (move.Level == 0) { endFace = LeftFace; } else if (move.Level == faceMax) { endFace = RightFace; } for (i = 0; i < cubeSize; i++) { j = Math.Abs(i - faceMax); planeValue = FrontFace.GetFaceValue(move.Level, i); //do plane move if (move.Direction == CubeMoveDirection.Right) { FrontFace.SetFaceValue(move.Level, i, UpFace.GetFaceValue(move.Level, i)); UpFace.SetFaceValue(move.Level, i, BackFace.GetFaceValue(move.Level, j)); BackFace.SetFaceValue(move.Level, j, DownFace.GetFaceValue(move.Level, j)); DownFace.SetFaceValue(move.Level, j, planeValue); } else { FrontFace.SetFaceValue(move.Level, i, DownFace.GetFaceValue(move.Level, j)); DownFace.SetFaceValue(move.Level, j, BackFace.GetFaceValue(move.Level, j)); BackFace.SetFaceValue(move.Level, j, UpFace.GetFaceValue(move.Level, i)); UpFace.SetFaceValue(move.Level, i, planeValue); } //do face move maybe DoFaceMove(endFace, move.Direction, i, j); } break; case CubePlane.Y: //save before move if (move.Level == 0) { endFace = FrontFace; } else if (move.Level == faceMax) { endFace = BackFace; } for (i = 0; i < cubeSize; i++) { j = Math.Abs(i - faceMax); planeValue = LeftFace.GetFaceValue(z, i); //do plane move if (move.Direction == CubeMoveDirection.Right) { LeftFace.SetFaceValue(z, i, DownFace.GetFaceValue(j, move.Level)); DownFace.SetFaceValue(j, move.Level, RightFace.GetFaceValue(z, j)); RightFace.SetFaceValue(z, j, UpFace.GetFaceValue(i, move.Level)); UpFace.SetFaceValue(i, move.Level, planeValue); } else { LeftFace.SetFaceValue(z, i, UpFace.GetFaceValue(i, move.Level)); UpFace.SetFaceValue(i, move.Level, RightFace.GetFaceValue(z, j)); RightFace.SetFaceValue(z, j, DownFace.GetFaceValue(j, move.Level)); DownFace.SetFaceValue(j, move.Level, planeValue); } //do face move maybe DoFaceMove(endFace, move.Direction, i, j); } break; case CubePlane.Z: //save before move if (move.Level == 0) { endFace = DownFace; } else if (move.Level == faceMax) { endFace = UpFace; } for (i = 0; i < cubeSize; i++) { j = Math.Abs(i - faceMax); planeValue = FrontFace.GetFaceValue(i, move.Level); //do plane move if (move.Direction == CubeMoveDirection.Right) { FrontFace.SetFaceValue(i, move.Level, RightFace.GetFaceValue(j, move.Level)); RightFace.SetFaceValue(j, move.Level, BackFace.GetFaceValue(j, move.Level)); BackFace.SetFaceValue(j, move.Level, LeftFace.GetFaceValue(i, move.Level)); LeftFace.SetFaceValue(i, move.Level, planeValue); } else { FrontFace.SetFaceValue(i, move.Level, LeftFace.GetFaceValue(i, move.Level)); LeftFace.SetFaceValue(i, move.Level, BackFace.GetFaceValue(j, move.Level)); BackFace.SetFaceValue(j, move.Level, RightFace.GetFaceValue(j, move.Level)); RightFace.SetFaceValue(j, move.Level, planeValue); } //do face move maybe DoFaceMove(endFace, move.Direction, i, j); } break; } }