private void subtractionWithTiles() { for (int i = 0; i < destroyTile.Length; i++) { GameObject tileObj = destroyTile[i]; Destroy(tileObj); } opConcluded = true; while (tiles.First != null) { LinkedListNode <GameObject> tileNode = tiles.First; GameObject tileObj = tileNode.Value; BoxCollider2D boxTile = tileObj.GetComponent <BoxCollider2D>(); boxTile.isTrigger = false; Destroy(tileObj); tiles.RemoveFirst(); } if (resultTileSubtration != null) { BoxCollider2D boxRef = tilesBeforeAfter.First.Value.GetComponent <BoxCollider2D>(); BoxCollider2D boxTileResult = resultTileSubtration.GetComponent <BoxCollider2D>(); GameObject block1 = tilesBeforeAfter.First.Value; //Deve ser colocado um block1 embaixo do lugar que a parede estar para o resultado ir Vector3 tileRef = new Vector3(block1.transform.position.x, block1.transform.position.y + (1.63f * resultado), -0.73f); if (numResul != null) { Destroy(numResul); } float positionx = tileRef.x; float positiony = tileRef.y - 0.4f; TilesController resultController = resultTileSubtration.GetComponent <TilesController>(); resultController.setLocationX(positionx); resultController.setLocaltionY(positiony); resultController.isNotBlocking(); resultController.move(); } }
private void sumWithTiles() { opConcluded = true; Vector3 tileRef = new Vector3(tilesBeforeAfter.First.Value.GetComponent <BoxCollider2D>().bounds.max.x, tilesBeforeAfter.First.Value.GetComponent <BoxCollider2D>().bounds.max.y, -0.73f); Destroy(numResul); while (tiles.First != null) { LinkedListNode <GameObject> tileNode = tiles.First; GameObject tileObj = tileNode.Value; BoxCollider2D boxTile = tileObj.GetComponent <BoxCollider2D>(); boxTile.isTrigger = false; TilesController tileController = tileObj.GetComponent <TilesController>(); float positionx = tileRef.x + boxTile.bounds.extents.x; float positiony = tileRef.y - boxTile.bounds.extents.y; tileController.setLocationX(positionx - defasagem(tileObj.tag)); tileController.setLocaltionY(positiony); tileController.move(); tileRef = new Vector3(positionx + boxTile.bounds.extents.x, positiony + boxTile.bounds.extents.y, -0.73f); tiles.RemoveFirst(); } }