IEnumerator thiscoroutine() { yield return(new WaitForSeconds(1.1f)); Destroy(gameObject); Destroy(space); Destroy(up); Destroy(down); Destroy(left); Destroy(right); Debug.Log("you lose"); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.vahennaelama(); skripti.randomkentta(); /* * public Transform space; * public Transform up; * public Transform down; * public Transform left; * public Transform right;*/ }
IEnumerator losecoroutine() { yield return(new WaitForSeconds(3.5f)); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.vahennaelama(); skripti.randomkentta(); }
void lose() { Debug.Log("you lose"); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.vahennaelama(); skripti.randomkentta(); }
void win() { Debug.Log("you win"); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.lisaapiste(); skripti.randomkentta(); }
IEnumerator wincoroutine() { yield return(new WaitForSeconds(3.5f)); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.lisaapiste(); skripti.randomkentta(); }
void OnCollisionEnter2D(Collision2D coll) { Debug.Log("you lose"); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.vahennaelama(); skripti.randomkentta(); }
public void win() { Debug.Log("u won"); lauta.SendMessage("win"); speed = 0; Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.lisaapiste(); skripti.randomkentta(); }
// BOOM BOOM BANG public void shoot() { laukaus.SetActive(true); ruudut.SetActive(false); paskaruutu.SetActive(true); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.lisaapiste(); skripti.randomkentta(); }
// Update is called once per frame void Update() { zrot = zrot + Time.deltaTime * kerroin; gameObject.transform.eulerAngles = new Vector3(0, 0, zrot); if (zrot < raja_arvo) { Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.vahennaelama(); skripti.randomkentta(); } }
void lose() { Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); anim.SetBool("losed", true); Debug.Log("you lose"); losed = true; speed = 0; speed2 = 0; skripti.vahennaelama(); skripti.randomkentta(); }
IEnumerator thatcoroutine() { yield return(new WaitForSeconds(3.1f)); Debug.Log("you win"); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.lisaapiste(); skripti.randomkentta(); /* * public Transform space; * public Transform up; * public Transform down; * public Transform left; * public Transform right;*/ }
//poks void OnTriggerEnter2D(Collider2D other) { Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); if (quit) { Application.Quit(); } if (!randomikentta) { skripti.uusikentta(seuraavataso); } else { skripti.randomkentta(); } Debug.Log("uusikentta"); }
// Update is called once per frame void Update() { if (tackler.transform.position.x < transform.position.x && olikooikein) { pyllahdys = true; } else if (tackler.transform.position.x < transform.position.x && ohitti == false) { transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z); ohitti = true; Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.randomkentta(); skripti.lives--; } if (pyllahdys) { //skaalaus if (skaalaus.x > skaalausraja) { float skaalaussuhde = Time.deltaTime * skaalauskerroin; skaalaus.x = skaalaus.x - skaalaussuhde; skaalaus.y = skaalaus.y - skaalaussuhde; skaalaus.z = skaalaus.z - skaalaussuhde; transform.localScale = skaalaus; //kierto transform.Rotate(Vector3.forward, kierto); //pyllähdys pyllahdysvaihe = (pyllahdysvaihe - Time.deltaTime * 1.5f); transform.Translate(0, pyllahdysvaihe * pyllykerroin, 0, Space.World); } else { SpriteRenderer rendereri = gameObject.GetComponent <SpriteRenderer>(); rendereri.sortingOrder = 2; Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.totalscore++; skripti.randomkentta(); } } }
void endgame() { anim.SetBool("pum", true); if (!alustus) { //this.transform.position = Vector3.MoveTowards(transform.position, pari.position, etaisyys); alustus = true; } //float step = speed * Time.deltaTime; //transform.position = Vector3.MoveTowards(transform.position, target.position, step); //Destroy(gameObject); Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.lisaapiste(); skripti.randomkentta(); }
void Awake() { // singletonihomma if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); //Time.fixedDeltaTime ehkä pitää implementoida jos fysiikat sekoilee fade = -1; // Set the texture so that it is the the size of the screen and covers it. GetComponent <GUITexture>().pixelInset = new Rect(0f, 0f, Screen.width, Screen.height); GetComponent <GUITexture>().enabled = true; }
void Awake() { // singletonihomma if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); //Time.fixedDeltaTime ehkä pitää implementoida jos fysiikat sekoilee fade = -1; // Set the texture so that it is the the size of the screen and covers it. GetComponent<GUITexture>().pixelInset = new Rect(0f, 0f, Screen.width, Screen.height); GetComponent<GUITexture>().enabled = true; }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.Space)) { pressed = true; } if (!pressed) { return; } if (angle < maxAngle) { angle += 100 * Time.deltaTime * rotationSpeed; transform.eulerAngles = new Vector3(0, 0, angle); } else { Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); if (kasi.transform.position.x < maxOsuu && kasi.transform.position.x > minOsuu) { osuu = true; } kahviosuu1.SendMessage("uusipaikka", kahvipaikka1); kahviosuu2.SendMessage("uusipaikka", kahvipaikka2); if (osuu) { kahviohi.SendMessage("uusipaikka", kahvipaikka3); skripti.lisaapiste(); skripti.randomkentta(); } else { skripti.vahennaelama(); skripti.randomkentta(); } } }
void Awake() { // singletonihomma if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); //Time.fixedDeltaTime ehkä pitää implementoida jos fysiikat sekoilee Time.timeScale = timescale; fade = -1; // Set the texture so that it is the the size of the screen and covers it. guiTexture.pixelInset = new Rect(0f, 0f, Screen.width, Screen.height); guiTexture.enabled = true; pistelisatty = false; henkilahtenyt = true; }
// Update is called once per frame void Update() { if (punnauskerroin > 3) { punnauskerroin = 3f; } if (peliohi) { paarender.color = new Color(paarender.color.r, paarender.color.g + 0.1f, paarender.color.g + 0.1f); if (paa.transform.localScale.x > 1) { paa.transform.localScale = new Vector3(paa.transform.localScale.x - Time.deltaTime / 5, paa.transform.localScale.y - Time.deltaTime / 5); } oikeaverho.GetComponent <punnariesiriippu>().auki = false; vasenverho.GetComponent <punnariesiriippu>().auki = false; paa_anim.SetBool("rajahti", false); if (oikeaverho.GetComponent <punnariesiriippu>().avonaisuus < 0.2) { Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); if (voitto) { skripti.totalscore++; } else { skripti.lives--; } skripti.randomkentta(); } } else { // punnataan if (punnausvaihe) { paa_anim.SetBool("irvistys", false); if (punnailee) { punnailutimer = punnailutimer + Time.deltaTime; animaattori.SetBool("punnaaminen", true); } if (punnailutimer > 0.2f && punnailee) { punnailee = false; punnailutimer = 0f; animaattori.SetBool("punnaaminen", false); } // PUNNAA PUNNAA variarvo = variarvo + Time.deltaTime / 12000; paarender.color = new Color(paarender.color.r, paarender.color.g - variarvo, paarender.color.b - variarvo); paa.transform.localScale = new Vector3(paa.transform.localScale.x + Time.deltaTime / 75, paa.transform.localScale.y + Time.deltaTime / 75); //PÄÄ PULLISTUU, PUNNAA-PUNNAA! // punnaus kasvaa if (punnausarvo < maksimipunni) { punnausarvo = punnausarvo + Time.deltaTime * punnauskerroin; } else { punnausarvo = punnausarvo - 0.2f; } // pää pullistuu // pää punoittaa //if (paarender.color.g > 0) paarender.color = new Color(paarender.color.r, paarender.color.g - variarvo, paarender.color.b - variarvo); //paarender.color = new Color(paarender.color.r, paarender.color.g + 0.03f, paarender.color.b + 0.03f); //kontrollit if (paa.transform.localScale.x > 1.5) { punnausvaihe = false; peliohi = true; paa_anim.SetBool("rajahti", true); } if (Input.GetKeyDown("left")) { if (lastpress != 0) { punnausarvo = punnausarvo - keyweight; punnailee = true; } lastpress = 0; } if (Input.GetKeyDown("down")) { if (lastpress != 1) { punnausarvo = punnausarvo - keyweight; punnailee = true; } lastpress = 1; } if (Input.GetKeyDown("right")) { if (lastpress != 2) { punnausarvo = punnausarvo - keyweight; punnailee = true; } lastpress = 2; } if (Input.GetKeyDown("space")) { if (lastpress != 3) { punnausarvo = punnausarvo - keyweight; punnailee = true; } lastpress = 3; } //kjäh, punnaa-punnaa if (Input.GetKeyDown("up")) { punnauskerroin = punnauskerroin + 0.5f; paa_anim.SetBool("irvistys", true); } } else { // huilitaan huilausaika = huilausaika + Time.deltaTime; if (huilausaika > 1f) { punnausvaihe = true; huilausaika = 0; paa_anim.SetBool("helpotus", false); uusipaska(); } } } }
// Update is called once per frame void Update() { ajastin = ajastin + Time.deltaTime; // telkkari päälle if (!tv_paalla && ajastin > 3) { tv_paalla = true; ajastin = 0; tvfiltteri.SetActive(true); } //sheriffin kosto if (!sheriffiarvottu) { sheriffchance = Random.Range(0, ohjelmat.Length - ohjelmajarjestys + 1); sheriffiarvottu = true; } // ohjelmia tulemaan if ((tv_paalla && ajastin > 1.5f) && !ohjelma) { //SHERIFFI if (sheriffchance == 0) { ohjelma = true; //varmuuden vuoksi for for (int i = 0; i < ohjelmat.Length; i++) { ohjelmat[i].SetActive(false); } sheriffi.SetActive(true); ajastin = 0; } else // jotain muuta { ohjelma = true; while (nahty[nykyinenohjelma] == true) { nykyinenohjelma = Random.Range(0, 6); } ohjelmat[nykyinenohjelma].SetActive(true); nahty[nykyinenohjelma] = true; ajastin = 0; ohjelmajarjestys++; } } if ((ohjelma && ajastin > 3)) { ohjelmat[nykyinenohjelma].SetActive(false); ohjelma = false; if (sheriffchance != 0) { sheriffiarvottu = false; ajastin = 0; } } if (sheriffchance == 0 && ajastin > 1.5f) { tvpeli_sheriff sheriffiskripti = sheriffi.GetComponent <tvpeli_sheriff>(); sheriffiskripti.ammu(); tvkasi kasiskripti = kasi.GetComponent <tvkasi>(); kasiskripti.ammuttu = true; Game_logic_controller skripti = kontrolleri.GetComponent <Game_logic_controller>(); skripti.vahennaelama(); skripti.randomkentta(); } }