public bool RaycastWithDetection(Ray rayToCast, SelectedSize selectedSize, out Pose buildablePose) { RaycastHit hitInfo; buildablePose = new Pose(); Debug.DrawRay(rayToCast.origin, rayToCast.direction * 100, Color.yellow, 100f); bool detectectedBlock = DetectBlock(rayToCast, out hitInfo); if (detectectedBlock) { //position does not have to be transformed, as we are going reflecting from an already anchor-relative position Vector3 buildablePosition = CalcAdjustedNormalPosition(hitInfo, selectedSize) + hitInfo.transform.position; //TODO fix rotation //Make rotation along be along the normal //Have to use Euler angles to express Quaternion as a Vector Vector3 rot = hitInfo.transform.rotation.eulerAngles; // hit object rotation Vector3 adjustedRotation = new Vector3(0, rot.y, 0); Quaternion buildableRotation = Quaternion.Euler(adjustedRotation); // Quaternion buildableRotation = transform.LookAt(hitInfo.transform.position + hitInfo.transform.forward, // hitInfo.normal); buildablePose = new Pose(buildablePosition, buildableRotation); } return(detectectedBlock); }
public string Name() { string name = Item.Name; if (Item.HasSize) { name = name + "(" + SelectedSize.ToString() + ")"; } if (Item.CanHaveSauce) { if (SelectedSauce != null) { name = name + ", " + SelectedSauce.Name.ToString(); } else { name = name + ", sans sauce"; } } if (Item.CanBeSalt) { if (SelectedSalt) { name = name + ", avec sel"; } else { name = name + ", sans sel"; } } if (Item.CanBeHotNotCold) { if (SelectedHotNotCold) { name = name + ", chaud"; } else { name = name + ", froid"; } } if (Item.CanHaveMeat) { name = name + ", " + SelectedMeat.Name.ToString(); } return(name); }
private void UpdateSizeSelection(SelectedSize selectedSize) { Xamarin.Forms.Shapes.Rectangle selectedRect = SmallRect; Xamarin.Forms.Shapes.Path selectedCup = SmallCup; switch (selectedSize) { case SelectedSize.small: selectedRect = SmallRect; selectedCup = SmallCup; break; case SelectedSize.medium: selectedRect = MediumRect; selectedCup = MediumCup; break; case SelectedSize.large: selectedRect = LargeRect; selectedCup = LargeCup; break; } // clear the selections SolidColorBrush unselectedBackground = new SolidColorBrush(Color.FromHex("F8F8F8")); SolidColorBrush unselectedStroke = new SolidColorBrush(Color.FromHex("E1E1E1")); SolidColorBrush selectedBackground = new SolidColorBrush(Color.FromHex("E5F0EC")); SolidColorBrush selectedStroke = new SolidColorBrush(Color.FromHex("1B714B")); SmallRect.Fill = unselectedBackground; SmallRect.Stroke = unselectedStroke; MediumRect.Fill = unselectedBackground; MediumRect.Stroke = unselectedStroke; LargeRect.Fill = unselectedBackground; LargeRect.Stroke = unselectedStroke; SmallCup.Stroke = unselectedStroke; MediumCup.Stroke = unselectedStroke; LargeCup.Stroke = unselectedStroke; // move the selectionRectangle SelectionRect.LayoutTo(selectedRect.Bounds, 100, Easing.CubicInOut); // update the background colors selectedRect.Fill = selectedBackground; // update the stroke on the cup selectedCup.Stroke = selectedStroke; }
private Vector3 CalcAdjustedNormalPosition(RaycastHit hitInfo, SelectedSize selectedSize) { Vector3 normal = hitInfo.normal; switch (selectedSize) { case SelectedSize.Mini: return(normal / 8); case SelectedSize.Small: return(normal / 4); case SelectedSize.Large: return(normal / 1.4f); default: return(normal / 2); } }
public void OnLargeClicked() { m_SelectedSize = SelectedSize.Large; }
public void OnMediumClicked() { m_SelectedSize = SelectedSize.Medium; }
public void OnSmallClicked() { m_SelectedSize = SelectedSize.Small; }
//Size Selection public void OnMiniClicked() { m_SelectedSize = SelectedSize.Mini; }
public void CmdSpawnObject(SelectedObject selectedObject, SelectedSize selectedSize, Vector3 position, Quaternion rotation) { GameObject prefabToSpawn; if (selectedSize == SelectedSize.Mini) { switch (selectedObject) { case SelectedObject.Blocks: prefabToSpawn = MiniBlocksPrefab; break; case SelectedObject.BlocksVertical: prefabToSpawn = MiniBlocksVertPrefab; break; case SelectedObject.BlocksCorner: prefabToSpawn = MiniBlocksCorner; break; default: prefabToSpawn = MiniBlockPrefab; break; } } else if (selectedSize == SelectedSize.Small) { switch (selectedObject) { case SelectedObject.Blocks: prefabToSpawn = SmallBlocksPrefab; break; case SelectedObject.BlocksVertical: prefabToSpawn = SmallBlocksVertPrefab; break; case SelectedObject.BlocksCorner: prefabToSpawn = SmallBlocksCorner; break; default: prefabToSpawn = SmallBlockPrefab; break; } } else if (selectedSize == SelectedSize.Large) { switch (selectedObject) { case SelectedObject.Blocks: prefabToSpawn = LargeBlocksPrefab; break; case SelectedObject.BlocksVertical: prefabToSpawn = LargeBlocksVertPrefab; break; case SelectedObject.BlocksCorner: prefabToSpawn = LargeBlocksCorner; break; default: prefabToSpawn = LargeBlockPrefab; break; } } else { switch (selectedObject) { case SelectedObject.Blocks: prefabToSpawn = BlocksPrefab; break; case SelectedObject.BlocksVertical: prefabToSpawn = BlocksVertPrefab; break; case SelectedObject.BlocksCorner: prefabToSpawn = BlocksCorner; break; default: prefabToSpawn = BlockPrefab; break; } } var blockObject = Instantiate(prefabToSpawn, position, rotation); // Spawn the object in all clients. NetworkServer.Spawn(blockObject); }
//Quick hack to avoid chaning Prefab scale - as scale is not transferred over UNet public void SpawnObject(SelectedObject selectedObject, SelectedSize selectedSize, Vector3 position, Quaternion rotation) { CmdSpawnObject(selectedObject, selectedSize, position, rotation); }
/// <summary> /// Method to execute calculation /// </summary> private void CalculateAmountExecute() { try { if (SelectedSize == null) { MessageBox.Show("Please choose size of pizzaModel", "Notification"); } else { if (Salami.IsSelectedIngredient) { SideDishesForPizza.Add(Salami); } if (Ham.IsSelectedIngredient) { SideDishesForPizza.Add(Ham); } if (Kulen.IsSelectedIngredient) { SideDishesForPizza.Add(Kulen); } if (Ketchup.IsSelectedIngredient) { SideDishesForPizza.Add(Ketchup); } if (Mayoneese.IsSelectedIngredient) { SideDishesForPizza.Add(Mayoneese); } if (Chilly.IsSelectedIngredient) { SideDishesForPizza.Add(Chilly); } if (Olives.IsSelectedIngredient) { SideDishesForPizza.Add(Olives); } if (Oregano.IsSelectedIngredient) { SideDishesForPizza.Add(Oregano); } if (Sesame.IsSelectedIngredient) { SideDishesForPizza.Add(Sesame); } if (Cheese.IsSelectedIngredient) { SideDishesForPizza.Add(Cheese); } SelectedSize.Ingredients = SideDishesForPizza; if (SideDishesForPizza == null) { MessageBox.Show("Please add ingredients for pizzaModel", "Notification"); } else { TotalPrice = SelectedSize.CalculateAmount(); CanChoose = false; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }