void addSkillLevelIcon(Rect r, LevelUpSystem.ActiveSpell spell, Texture2D icon) { GUI.Button(new Rect(r.x+icon.width-3-icon_skill_lvl.width-2, r.y+icon.height-3-icon_skill_lvl.height-1, icon_skill_lvl.width, icon_skill_lvl.height),icon_skill_lvl, spellButtonStyle); GUI.Label(new Rect(r.x+10, r.y+11, r.width, r.height), string.Format("{0}", spell.level), skilllvlTextStyle); }
private void Awake() { rb = GetComponent <Rigidbody>(); anim = GetComponent <Animator>(); levelUpSystem = GetComponent <LevelUpSystem>(); gameManager = FindObjectOfType <GameManager>(); gameManager.setCharacterLevel(levelUpSystem.getCurrentLevel()); //set experience levelUpSystem.addEp(gameManager.GetStoredExperience()); //set level gameManager.setCharacterLevel(levelUpSystem.getCurrentLevel()); }
void Start() { _health = maxHealth; GameObject playerGO = GameObject.FindGameObjectWithTag("Player"); if (playerGO != null) { _levelUpSystem = playerGO.GetComponent <LevelUpSystem>(); } else { Debug.LogError("Player is missing from the scene"); } _audioSource = GetComponent <AudioSource>(); }
void Start() { health = maxHealth; GameObject playerGO = GameObject.FindGameObjectWithTag("Player"); if(playerGO != null) { levelUpSystem = playerGO.GetComponent<LevelUpSystem>(); } else { Debug.LogError("Player is missing from the scene"); } audioSource = GetComponent<AudioSource>(); }
void createLvlUpSkillButton(LevelUpSystem.Spell skill, Rect r) { glow += Time.deltaTime*0.3f; GUI.backgroundColor = new Color(GUI.backgroundColor.r, GUI.backgroundColor.g, GUI.backgroundColor.b, Mathf.Sin(glow)+1.3f); if(lvlSystem.skillPoints > 0) { if(GUI.Button(r, "",lvlupskillStyle)) lvlSystem.up_skill(skill); } else { glow = 0; } GUI.backgroundColor = new Color(GUI.backgroundColor.r, GUI.backgroundColor.g, GUI.backgroundColor.b, 1); }
void createToolTip(Rect r, LevelUpSystem.PassiveSpell skill) { if(r.Contains (Event.current.mousePosition)) { GUI.color = Color.yellow; GUI.Box (new Rect(156, 120,200,100), ""); GUI.Box (new Rect(156, 120,200,100), skill.name+" (lvl "+skill.level+")", skillTitleTextStyle); GUI.color = Color.white; if(skill == lvlSystem.passives[0]) { GUI.Box (new Rect(156, 120,200,100), "\n\nAttack Damage: "+ player.GetComponent<PlayerAttributes>().atkDamage, skillDescriptionTextStyle); } else { GUI.Box (new Rect(156, 120,200,100), "\n\nMax. HP: "+maxHealth, skillDescriptionTextStyle); } GUI.Box (new Rect(156, 120,200,100), "\n\n\n\n"+skill.getDescription(), skillDescriptionTextStyle); } }
void Update(){ if (kills == null) kills = GameObject.FindWithTag("MainCamera").GetComponent<killCounter>(); if (levelUpScript == null) levelUpScript = GameObject.FindWithTag("MainCamera").GetComponent<LevelUpSystem>(); }
void Start (){ levelUpScript = GameObject.FindWithTag("MainCamera").GetComponent<LevelUpSystem>(); kills = GameObject.FindWithTag("MainCamera").GetComponent<killCounter>(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); lvlSystem = player.GetComponent <LevelUpSystem>(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); lvlSystem = player.GetComponent<LevelUpSystem>(); }
void SpellButton(Rect r, LevelUpSystem.ActiveSpell active, Texture2D icon, KeyCode key, GUIStyle style) { createToolTip(r, active); if(!active.isAvailable()) GUI.color = new Color(0.4f,0.4f,0.4f,1); if((Event.current.type == EventType.KeyDown && Event.current.keyCode == key || GUI.Button(r,icon, style)) && active.isAvailable() && player.GetComponent<Controls>().cantMove == 0) { if(active.manaCost <= mana) { if(active.Equals(lvlSystem.actives[0])) { if(health < maxHealth) lvlSystem.activate_skill(active); } else if(active.Equals(lvlSystem.actives[1]) || active.Equals(lvlSystem.actives[2])) { if(player.GetComponent<Controls>().grounded) lvlSystem.activate_skill(active); } else lvlSystem.activate_skill(active); } else { audio.PlayOneShot(outOfMana); } } if(active.onCoolDown() && active.level > 0){ GUI.Label(r,string.Format("{0:F1}",active.cooldown -(Time.time-active.lastCastTime)), coolDownTextStyle); } addSkillLevelIcon(r, active, icon); GUI.color = Color.white; }
void PassiveSpellButton(Rect r, LevelUpSystem.PassiveSpell passive, Texture2D icon, GUIStyle style) { createToolTip(r, passive); GUI.Button(r,icon, style); addSkillLevelIcon(r, passive, icon); }
void createToolTip(Rect r, LevelUpSystem.ActiveSpell skill) { if(r.Contains (Event.current.mousePosition)) { GUI.color = Color.yellow; GUI.Box (new Rect(156, 120,200,130), ""); GUI.Box (new Rect(156, 120,200,130), skill.name+" (lvl "+skill.level+")", skillTitleTextStyle); GUI.color = Color.white; GUI.Box (new Rect(156, 120,200,130), "\n\n"+skill.getInfo(), skillDescriptionTextStyle); GUI.Box (new Rect(156, 120,200,130), "\n\n\n\n\n"+skill.getDescription(), skillDescriptionTextStyle); } }