private void InitBrick(RecipeBrickVisualization vis, RecipeBrick recBrick) { vis.SetColor(colorPalette.Colors[recBrick.GetID()]); Vector3 pos = transform.position + recBrick.GetVoxels()[1].getCenter() * SCALE; Quaternion rot = Quaternion.LookRotation(GetMajorAxis(recBrick.GetVoxels())); vis.transform.SetPositionAndRotation(pos, rot); }
private bool MatchIngredient(RecipeBrick ingredient) { if (ingredient.GetVoxels().Length == 0) { Debug.LogError($"Recipe {currentRecipe} is corrupt."); // TODO handle this error in a nice way currentRecipe = FindObjectOfType <Cookbook>().GetNext(); return(false); } // check if any of the brick matches the one in the recipe foreach (var brick in bricks) { if (brick.Match(ingredient) == true) { return(true); } } // return false if none of the placed bricks matches return(false); }