private void OnTriggerEnter(Collider other) { Debug.Log("Entered pan trigger zone"); if (other.GetComponent <TempIngredient>()) { ingredientInfo = other.GetComponent <TempIngredient>(); Debug.Log("is oil in pan? " + isOilInPan); bool tempBool = ingredientInfo.CheckMat() == ingredientInfo.cookingMat; Debug.Log("is pancake alr burnt? " + tempBool); Debug.Log("cookingMat: " + ingredientInfo.cookingMat.name); Debug.Log("checkMat: " + ingredientInfo.CheckMat().name); //if oil has bee nadded tothe pan and the pancake is not already burnt if (isOilInPan && ingredientInfo.cooking.State != "burned") { Debug.Log("start cooking raw pancake"); cookTimer.GetComponent <TimerUI>().ToggleHelper(true); cookingStarted = StartCoroutine(Cooking(cookTimer.GetComponent <TimerUI>(), ingredientInfo.heatingTime)); } else { Debug.Log("Burning!"); StartBurning(); } } }
private void dgvImportList_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { var selectedIngredient = dgvImportList.Rows[e.RowIndex].DataBoundItem as Ingredient; var check = listImportTemp.FirstOrDefault(c => c.Id == selectedIngredient.Id); if (check == null || check.Id <= 0) { var temp = new TempIngredient(); temp.Id = selectedIngredient.Id; temp.Name = selectedIngredient.Name; temp.Unit = selectedIngredient.Unit; temp.Price = (decimal)selectedIngredient.Price; temp.Quantity = 1; listImportTemp.Add(temp); } else { check.Quantity += 1; } LoadItemImport(); } }
//cut the mesh of the object when the blade hits the object private void OnCollisionEnter(Collision collision) { if (collision.gameObject.GetComponent <TempIngredient>()) { //get collision ingredient properties TempIngredient collisionProperties = collision.gameObject.GetComponent <TempIngredient>(); if (collision.gameObject.GetComponent <TempIngredient>().canBeCut) { //ensure that the object is only cut once if (collisionProperties.isColliding) { return; } else { Debug.Log("Knife entered " + collision.gameObject.name); collisionProperties.isColliding = true; } GameObject ogGameObj = collision.gameObject; string ogGameObjName = collision.gameObject.name; GameObject victim = collision.collider.gameObject; GameObject[] pieces = BLINDED_AM_ME.MeshCut.Cut(victim, transform.position, transform.right, capMaterial); //hold the index number of the piece int pieceIndexNum = 0; foreach (GameObject piece in pieces) { piece.transform.parent = ogGameObj.transform.parent; //rename each piece after the original parent + their index num piece.gameObject.name = ogGameObjName + "_piece" + pieceIndexNum; Debug.Log("cut piece " + Array.IndexOf(pieces, piece) + ": " + piece.gameObject.name); pieceIndexNum++; AddCollidersToNewPiece(piece); if (!piece.gameObject.GetComponent <TempIngredient>()) { piece.gameObject.AddComponent <TempIngredient>(ogGameObj.GetComponent <TempIngredient>()); //Note: Get obj data from CSV reader in future } } //end of foreach } //end of if ingredient can be cut statement } //end of if collider has ingredient script statement } //end of OnCollisionEnter