/*void OnCollisionEnter2D(Collision2D colll) * { * Debug.Log("death1111"); * if(colll.gameObject.tag=="Birds") * { * Debug.Log("death"); * text.SetActive (true); * player.SetActive (false); * button.SetActive (true); * } * }*/ void Start() { mycol = GetComponent <Collider2D>(); PotScript = GameObject.FindGameObjectWithTag("pot").GetComponent <pot>(); LolipopScript = GameObject.FindGameObjectWithTag("lolipop").GetComponent <collectable>(); highscore = PlayerPrefs.GetInt("highscore"); }
public void make() { if (play) { GameObject obj2 = Instantiate(potprefeb, where[0].transform.position, where[0].transform.rotation); pot po = obj2.GetComponent <pot>(); pos = where[0].transform.position; float x = Random.Range(-16, 16); pos.x = x / 7; obj2.transform.position = pos; // GameObject obj = Instantiate(potprefeb, transform.position, transform.rotation); // obj.transform.position = pos; } }
void Start() { newbestshitter = false; highscore = PlayerPrefs.GetFloat("highscore", highscore); loopplay = GetComponent <AudioSource>(); potscrit = pot.GetComponent <pot>(); loopplay.Play(); scoreno = 0; _score.enabled = false; _shitover.enabled = false; seenscript = origion.GetComponent <seen>(); incspeed = 2; StartCoroutine(incscorebyone()); }
private void OnTriggerEnter2D(Collider2D other) { text.enabled = true; if (text2 != null) { text2.enabled = true; } if (other.gameObject.name == "player") { if (asset != null) { pot assetScript = (pot)asset.GetComponent(typeof(pot)); assetScript.canDestroy = true; } } }
// 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(); } } } }
private void OnTriggerExit(Collider other) { if (other.CompareTag("item") && item != null && item.isPick == false) { item.outlinerItem.enabled = false; item.interactionIcon.SetActive(false); item = null; } //pot if (other.CompareTag("pot") && potActuel != null) { potActuel.outlinerItem.enabled = false; potActuel.interactionIcon.SetActive(false); potActuel.interactionIcon2.SetActive(false); potActuel = null; } //panneau if (other.CompareTag("panneau") && panneau != null) { panneau.outlinerItem.enabled = false; panneau.interactionIcon.SetActive(false); panneau = null; } //dialogue if (other.CompareTag("dialogue") && dialogueActuel != null) { //if (managerDialogue.dialogueActive == false) //{ dialogueActuel.DesactiveOutline(); isTalk = false; dialogueActuel.camDialogue.Priority = 0; dialogueActuel.camDialogue.enabled = false; //dialogueActuel.UpgradeQuest(); //dialogueActuel.UpgradeAnimalTalk(); //dialogueActuel.StopDialogue(); dialogueActuel.enabled = false; dialogueActuel = null; managerDialogue.dialogueActive = false; //} } //banc if (other.CompareTag("banc") && bancActuel != null) { bancActuel.DesactiveOutline(); bancActuel.enabled = false; bancActuel = null; } }
private void OnTriggerStay(Collider other) { if (other.CompareTag("item"))//outline { type = PlayerMovement.interactionType.item; if (item == null) { item = other.gameObject.GetComponent <itemPick>(); } if (item.isPick == false) { item.outlinerItem.enabled = true; item.interactionIcon.SetActive(true); } else { item.outlinerItem.enabled = false; item.interactionIcon.SetActive(false); } } //pot if (other.CompareTag("pot"))//outline { type = PlayerMovement.interactionType.pot; if (potActuel == null) { potActuel = other.gameObject.GetComponent <pot>(); } if (potActuel.fleurDePot.activeInHierarchy == false) { potActuel.outlinerItem.enabled = true; potActuel.interactionIcon.SetActive(true); potActuel.interactionIcon2.SetActive(true); } } //panneau if (other.CompareTag("panneau"))//outline { type = PlayerMovement.interactionType.panneau; if (panneau == null) { panneau = other.gameObject.GetComponent <cartePanneau>(); } panneau.outlinerItem.enabled = true; panneau.interactionIcon.SetActive(true); } //dialogue if (other.CompareTag("dialogue")) { type = PlayerMovement.interactionType.dialogue; if (managerDialogue.dialogueActive == false) { dialogueActuel = null; if (dialogueActuel == null) { dialogueActuel = other.GetComponent <Dialogue_Trigger>(); } dialogueActuel.enabled = true; dialogueActuel.ActiveOutline(); } } //banc if (other.CompareTag("banc")) { type = PlayerMovement.interactionType.banc; bancActuel = other.GetComponent <banc>(); bancActuel.enabled = true; if (bancActuel.isBanc == false) { bancActuel.ActiveOutline(); } } }
void Start () { potScript = pot.GetComponent<pot> (); }
void Start() { potscript = pot.GetComponent <pot>(); potscript.speed = 4; InvokeRepeating("speedup", 3f, 4); }