void OnGUI() { float rx = Screen.width / 1920f; float ry = Screen.height / 1080f; GUI.matrix = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, new Vector3(rx, ry, 1)); GUI.depth = 0; GUI.Box(new Rect(1920 / 2 + 250, 1080 / 2 - 150, 200, 300), "", thestylebro); if (GUI.Button(new Rect(1920 / 2 + 430, 1080 / 2 - 150, 20, 20), closetext, closestyle)) { AudioSource.PlayClipAtPoint(closesound, transform.position); Destroy(gameObject); } GUI.Box(new Rect(1920 / 2 + 260, 1080 / 2 - 140, 50, 50), spells.getItemSprite(ID), icostyle); GUI.Label(new Rect(1920 / 2 + 320, 1080 / 2 - 140, 100, 35), spells.getItemName(ID)); GUI.Label(new Rect(1920 / 2 + 260, 1080 / 2 - 80, 180, 250), spells.getItemDescrip(ID), descriptionstyle); GUI.Label(new Rect(1920 / 2 + 320, 1080 / 2 - 110, 100, 25), spells.getItemGroup(ID)); if (spells.getIsReactable(ID)) { GUI.Label(new Rect(1920 / 2 + 260, 1080 / 2 + 120, 100, 20), "Reactive"); } if (!(spells.getIsReactable(ID) || spells.getItemIsKey(ID))) { if (GUI.Button(new Rect(1920 / 2 + 250, 1080 / 2 + 150, 100, 20), "Use", buttonstyle)) { AudioSource.PlayClipAtPoint(useitem, transform.position); playerscript.GainHealth(spells.getItemHPRestore(ID)); playerscript.stamina += Mathf.CeilToInt(spells.getItemStamRestore(ID)); if (spells.getItemXPGain(ID) > 0) { GameObject ja = Instantiate(Resources.Load("JoulesAnimation"), player.transform.position, player.transform.rotation) as GameObject; JouleAnimation ji = ja.GetComponent(typeof(JouleAnimation)) as JouleAnimation; ji.xp = (int)spells.getItemXPGain(ID); playerscript.xp += spells.getItemXPGain(ID); } if (ID != 11) { spells.RemoveItem(loc); } Destroy(gameObject); } } if (spells.getItemIsKey(ID)) { GUI.Label(new Rect(1920 / 2 + 400, 1080 / 2 + 120, 100, 20), "Key"); } else { if (ID != 11) { if (GUI.Button(new Rect(1920 / 2 + 350, 1080 / 2 + 150, 100, 20), "Drop", buttonstyle)) { AudioSource.PlayClipAtPoint(othersound, transform.position); spells.RemoveItem(loc); Destroy(gameObject); } } } }
public virtual void Die() { PlayDeathSound(); PlayerController pc = player.GetComponent(typeof(PlayerController)) as PlayerController; pc.isTargeting = false; pc.xp += worth; GameObject ja = Instantiate(Resources.Load("JoulesAnimation"), transform.position, transform.rotation) as GameObject; JouleAnimation ji = ja.GetComponent(typeof(JouleAnimation)) as JouleAnimation; ji.xp = worth; Destroy(gameObject); }
public override void Die() { PlayerController pc = player.GetComponent(typeof(PlayerController)) as PlayerController; Spells s = player.GetComponent(typeof(Spells)) as Spells; s.AddItem(14); pc.isTargeting = false; pc.xp += worth; GameObject ja = Instantiate(Resources.Load("JoulesAnimation"), transform.position, transform.rotation) as GameObject; JouleAnimation ji = ja.GetComponent(typeof(JouleAnimation)) as JouleAnimation; ji.xp = worth; Items p = player.GetComponent(typeof(Items)) as Items; p.bosses[1] = true; // you defeated! Destroy(gameObject); }
IEnumerator deathanimation() { Time.timeScale = 0.2f; yield return(StartCoroutine(CounterattackAnimation.CoroutineUtil.WaitForRealSeconds(3f))); Time.timeScale = 1f; PlayerController pc = player.GetComponent(typeof(PlayerController)) as PlayerController; Spells s = player.GetComponent(typeof(Spells)) as Spells; s.AddItem(12); s.AddItem(16); pc.isTargeting = false; pc.xp += worth; GameObject ja = Instantiate(Resources.Load("JoulesAnimation"), transform.position, transform.rotation) as GameObject; JouleAnimation ji = ja.GetComponent(typeof(JouleAnimation)) as JouleAnimation; ji.xp = worth; Items p = player.GetComponent(typeof(Items)) as Items; p.bosses[2] = true; // you defeated! Destroy(gameObject); }