void Update() { if (free) { float mouseX = Input.GetAxis("Mouse X"); float mouseY = -Input.GetAxis("Mouse Y"); float newRotY = mouseX * mouseSensitivity * Time.deltaTime; float newRotX = mouseY * mouseSensitivity * Time.deltaTime; // mise a jour uniquement s'il y modification de la rotation de la camera if (rotY + newRotY != rotY || rotX + newRotX != rotX) { rotY += newRotY; rotX += newRotX; rotX = Mathf.Clamp(rotX, -clampAngle, clampAngle); Quaternion localRotation = Quaternion.Euler(rotX, rotY, 0.0f); transform.rotation = localRotation; // mise a jour aliments plateau pour correction probleme slice AtelierManager.Instance().UpdateAlimentPlateau(); } } }
// fenetre modif quantité public void Modification(bool isActive) { AtelierManager.Instance().transform.GetChild(0).gameObject.SetActive(!isActive); AtelierManager.Instance().activateTypeButtons(!isActive); AtelierManager.Instance().showMealValidation(isActive); closeButton.SetActive(isActive); // scale plateau if (isActive) { transform.localScale *= 3.0f; transform.position += new Vector3(0.0f, 0.5f, 0.0f); AtelierManager.Instance().showValidation(false); } else { transform.localScale /= 3.0f; transform.position -= new Vector3(0.0f, 0.5f, 0.0f); if (GameObject.Find("SliderModif")) { GameObject.Find("SliderModif").GetComponent <SliderModif>().CloseAndKeepOldValues(); } AtelierManager.Instance().showModification(false); } modification = isActive; GetComponent <BoxCollider>().enabled = !isActive; CanInteractWithAliments(isActive); for (int al = 0; al < aliments.Count; al++) { foreach (Transform child in aliments[al].transform) { child.gameObject.GetComponent <BlocAliment>().SetAspectWithSlice(); } } }
private void OnMouseUp() { if (!MedicalAppManager.Instance().OnMeal) { //remettre l'ancien if (GameObject.Find("SliderModif") && MedicalAppManager.Instance().selectedAliment != null) { GameObject.Find("SliderModif").GetComponent <SliderModif>().CloseAndKeepOldValues(); } // ajout aliment selectionne dans le manager MedicalAppManager.Instance().selectedAliment = gameObject; // zone de modification AtelierManager.Instance().showModification(true); } else { if (MealManager.Instance().MangerPortion != null) { // affichage manger portion MedicalAppManager.Instance().selectedAliment = gameObject; MealManager.Instance().updateInfos(); MealManager.Instance().MangerPortion.SetActive(true); } } }
public void OnMouseDown() { if (!MedicalAppManager.Instance().OnMeal) { AtelierManager.Instance().Consigne.text = AtelierManager.Instance().Consignes[2]; Modification(true); } }
private void TaskOnClick() { // si bouton oui ajouter aliement au repas if (name == "YES") { AtelierManager.Instance().addAlimentToMeal(MedicalAppManager.Instance().selectedAliment, (int)GameObject.Find("SliderAjout").GetComponent <Slider>().value); } MedicalAppManager.Instance().selectedAliment = null; AtelierManager.Instance().showValidation(false); //Camera.main.GetComponent<MouseLook>().setCameraFree(true); }
public void setCameraFree(bool value) { free = value; AtelierManager.Instance().CursorTarget.enabled = value; if (!value) { Cursor.lockState = CursorLockMode.None; } else { Cursor.lockState = CursorLockMode.Locked; } }
private void OnMouseExit() { if (OnAtelier || OnMeal) { transform.localScale /= 1.2f; if (OnAtelier) { AtelierManager.Instance().setCursor("open"); } if (plane != null) { SetAspectWithSlice(); } } }
private void OnMouseEnter() { if (OnAtelier || OnMeal) { if (OnAtelier) { AtelierManager.Instance().setCursor("closed"); } transform.localScale *= 1.2f; if (plane != null) { SetAspectWithSlice(); } } }
void Remove() { //destruction dans les listes + gestion des portions GameObject toDeleate = MedicalAppManager.Instance().selectedAliment; foreach (Transform temp in MedicalAppManager.Instance().selectedAliment.transform)//je détruit ceux en trop { temp.parent = null; Destroy(temp.gameObject); } AtelierManager.Instance().Plateau.GetComponent <scriptPlateau>().aliments.Remove(toDeleate); Destroy(toDeleate); //replacer les aliments dans le plateau et réafficher repas AtelierManager.Instance().Plateau.GetComponent <scriptPlateau>().SetAlimentsPositions(); AtelierManager.Instance().updateInfosRepas(); Close(); }
private void OnMouseUp() { // ajout aliment selectionne dans le manager MedicalAppManager.Instance().selectedAliment = gameObject; if (OnPlate) { // zone de modification AtelierManager.Instance().showModification(true); } else if (OnMeal) { if (MealManager.Instance().MangerPortion != null) { // affichage manger portion MealManager.Instance().MangerPortion.SetActive(true); } } else if (OnAtelier) { // zone de validation AtelierManager.Instance().showValidation(true); //Camera.main.GetComponent<MouseLook>().setCameraFree(false); } }
private void TaskOnClick() { // affichage aliments en fonction de leur type AtelierManager.Instance().showAlimentType(typeName); }
void Close() { MedicalAppManager.Instance().selectedAliment = null; AtelierManager.Instance().showModification(false); }
public void Close() { //Camera.main.GetComponent<MouseLook>().setCameraFree(true); AtelierManager.Instance().Consigne.text = AtelierManager.Instance().Consignes[1]; Modification(false); }