public Barang interact(Barang tangan) { switch (state) { case 1: if (tangan.nama == "ikan") { state = 2; timer = waktuMasak; barang = tangan; return(new Barang()); } else { return(tangan); } case 3: if (tangan.isKosong()) { state = 1; return(barang); } else { return(tangan); } } return(tangan); }
// Update is called once per frame void Update() { if (barang.isKosong()) { gambar.color = new Color32(255, 255, 255, 0); } else { gambar.color = new Color32(255, 255, 255, 255); switch (barang.nama) { case "ikan goreng": gambar.sprite = goreng; break; case "ikan potong": gambar.sprite = potong; break; case "ikan rebus": gambar.sprite = sup; break; case "ikan": switch (barang.warna) { case "merah": gambar.sprite = merah; break; case "kuning": gambar.sprite = kuning; break; case "biru": gambar.sprite = biru; break; } break; } } }
public Barang interact(Barang tangan) { if (tangan.isKosong() & barang.isKosong()) { return(tangan); } Barang temp = barang; barang = tangan; return(temp); }
void interaksi() { if (Input.GetKeyDown("space") & !UI_Controller.isPaused) { switch (interact) { case "potong": if (tangan.nama == "ikan") { tangan.nama = "ikan potong"; } break; case "goreng": tangan = GameObject.Find("goreng").GetComponent <Masak>().interact(tangan); break; case "rebus": tangan = GameObject.Find("rebus").GetComponent <Masak>().interact(tangan); break; case "hold1": tangan = GameObject.Find("hold1").GetComponent <Hold>().interact(tangan); break; case "hold2": tangan = GameObject.Find("hold2").GetComponent <Hold>().interact(tangan); break; case "box ikan kuning": if (tangan.isKosong() && LevelDesigner.sisaIkanKuning > 0) { tangan.nama = "ikan"; tangan.warna = "kuning"; LevelDesigner.sisaIkanKuning--; } break; case "box ikan merah": if (tangan.isKosong() && LevelDesigner.sisaIkanMerah > 0) { tangan.nama = "ikan"; tangan.warna = "merah"; LevelDesigner.sisaIkanMerah--; } break; case "box ikan biru": if (tangan.isKosong() && LevelDesigner.sisaIkanBiru > 0) { tangan.nama = "ikan"; tangan.warna = "biru"; LevelDesigner.sisaIkanBiru--; } break; case "sampah": tangan.nama = ""; break; case "meja 1": if (tangan.nama != "") { kasihpesanan(1); } break; case "meja 2": if (tangan.nama != "") { kasihpesanan(2); } break; case "meja 3": if (tangan.nama != "") { kasihpesanan(3); } break; case "meja 4": if (tangan.nama != "") { kasihpesanan(4); } break; } } }