// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); cercaDetection = GetComponent <cerca>(); myPlayerHolder = GetComponent <holder>(); chefWalk = GetComponent <Animator>(); Plate = GetComponent <plate>(); humo.SetActive(false); Entrega = GetComponent <entrega>(); }
//remember for cylinder, width (y - scale) is half of real public void Init(Vector3 position, float angle) { //следующее звено FixedJoint fixedjoint = GetComponent <FixedJoint>(); GameObject next = fixedjoint.connectedBody.gameObject; holder nextbehavior = fixedjoint.connectedBody.GetComponent <holder>(); //размещаем следующее звено next.transform.localScale = new Vector3(nextbehavior.width, nextbehavior.length, nextbehavior.width); next.transform.position = new Vector3(transform.position.x, transform.position.y + (/*mul 2 for cylinder*/ 2 * width + nextbehavior.length) / 2, transform.position.z); //якорь шарнира fixedjoint.anchor = new Vector3(0.0f, 0.5f, 0.0f); //инициализируем следующие звенья nextbehavior.Init(position, angle); //поворот вокруг вертикальной оси transform.RotateAround(position, Vector3.down, angle); }
// Start is called before the first frame update void Start() { choppingHolder = GetComponent <holder>(); }
new(() => GetOrDefault(holder, name, defaultValue, comparisonType));
// Update is called once per frame public void Update() { timer(); float horizontalMove = Input.GetAxis("Horizontal"); float verticalMove = Input.GetAxis("Vertical"); moveTo = new Vector3(horizontalMove, 0, verticalMove); if (Input.GetKeyDown(KeyCode.Space)) { Entrega = FindObjectOfType <entrega>(); int tipo = Entrega.devolver(); Debug.Log("es: " + tipo); grab.Play(); table currentTable = cercaDetection.Getselected(); if (currentTable != null) { holder currentTableHolder = currentTable.GetComponent <holder>(); if (myPlayerHolder.HasMovable()) { movableObject movable = myPlayerHolder.GetMovable(); Trash trash = currentTable.GetComponent <Trash>(); entrega enter = currentTable.GetComponent <entrega>(); if (enter != null) { myPlayerHolder.RemoveMovable(); PlateTomato.SetActive(false); PlateCebolla.SetActive(false); PlateMushroom.SetActive(false); PlateBad.SetActive(false); empty.SetActive(true); pot Pot = GetComponent <pot>(); //GameObject potObject = Pot.full; //GameObject potObject1 = Pot.empty; //potObject.SetActive(false); //potObject1.SetActive(true); segundos = 0; if (marcador == tipo) { puntos += 100; puntaje.text = "" + puntos; marcador = 0; good.Play(); } else { puntos -= 50; puntaje.text = "" + puntos; marcador = 0; bad.Play(); } } if (trash != null) { myPlayerHolder.RemoveMovable(); Destroy(movable.gameObject); food Food = movable.GetComponent <food>(); myPlayerHolder.RemoveMovable(); drop.Play(); } else { movableObject tableMovable = currentTableHolder.GetMovable(); if (tableMovable != null) { drop.Play(); Container tableContainer = tableMovable.GetComponent <Container>(); if (tableContainer != null) { food FOOD = movable.GetComponent <food>(); if (FOOD != null) { if (tableContainer.CanAccept(FOOD)) { pot_number += 1; myPlayerHolder.RemoveMovable(); tableContainer.recived(FOOD); objeto.SetActive(false); drop.Play(); } if (pot_number == 3) { objeto_pot.SetActive(true); //pot_number = pot_number - 3; foodType r1 = tableContainer.resultado(); foodType r2 = tableContainer.resultado2(); foodType r3 = tableContainer.resultado3(); if (r3 == T && r2 == T && r1 == T) { empty.SetActive(false); PlateTomato.SetActive(true); marcador = 1; } else if (r3 == O && r2 == O && r1 == O) { empty.SetActive(false); PlateCebolla.SetActive(true); marcador = 0; } else if (r3 == M && r2 == M && r1 == M) { empty.SetActive(false); PlateMushroom.SetActive(true); marcador = 1; } else { empty.SetActive(false); PlateBad.SetActive(true); marcador = 0; } } } } } else { currentTableHolder.SetMovable(movable); myPlayerHolder.RemoveMovable(); } } } else { if (currentTableHolder.HasMovable()) { movableObject movable = currentTableHolder.GetMovable(); myPlayerHolder.SetMovable(movable); currentTableHolder.RemoveMovable(); } else { NewIngrediente ig = currentTable.GetComponent <NewIngrediente>(); if (ig != null) { movableObject movable = ig.GetIngredient(); myPlayerHolder.SetMovable(movable); } } } } } if (pot_number == 3) { table currentTable = cercaDetection.Getselected(); estufa Estufa = currentTable.GetComponent <estufa>(); if (Estufa != null) { segundos = segundos + 0.01f; if (segundos > 4) { Alarm.Play(); humo.SetActive(true); pot_number -= 3; potBurned.SetActive(true); } } } if (Input.GetKeyDown(KeyCode.LeftShift)) { table currentTable = cercaDetection.Getselected(); if (currentTable != null) { chopper currentChopper = currentTable.GetComponent <chopper>(); if (currentChopper != null) { objeto.SetActive(true); IsChopping = currentChopper.StartChooping(); } } } }