Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class Wizard : MonoBehaviour {
- #region variables
- public int playerActualLevel;
- public static int playerExperience;
- public int expNeededToLevelUp;
- public float skillCooldown = 0f;
- public float attackCooldown = 0f;
- public int outputdamage;
- public int coins_collected;
- [Header("Class Settings")]
- public bool fireMage;
- public bool iceMage;
- public bool xMage;
- public bool yMage;
- [Header("Health Settings")]
- public int StartingHealth = 10;
- public int currentPlayerHealth;
- [Header("Mana Settings")]
- public int StartingMana = 5;
- public int actuallMana;
- [Header("Skills of fire mage")]
- public GameObject fireball;
- public GameObject firebolt;
- public GameObject fireExplosion;
- public GameObject meteors;
- [Header("Skills of ice mage")]
- public GameObject iceball;
- [Header("Skills of heal mage")]
- //add later
- [Header("Skills of demonic mage")]
- //add later
- public GameObject healingAura;
- public GameObject ringOfDeath;
- [Header("Character Stats")]
- public int attackDamage=20;
- public int defense;
- public int skillDamage;
- #endregion
- void Start () {
- if (fireMage)
- {
- }
- else if (iceMage)
- {
- }
- else if (xMage){
- }
- else if (yMage)
- {
- }
- currentPlayerHealth = StartingHealth;
- GameObject Enemy = GameObject.Find("Enemy");
- Enemy enemy = Enemy.GetComponent<Enemy>();
- outputdamage=enemy.enemyAttack;
- }
- void Update() {
- skillCooldown -= Time.deltaTime;
- attackCooldown -= Time.deltaTime;
- print("player experience"+playerExperience);
- if (playerExperience >= expNeededToLevelUp)
- {
- playerActualLevel++;
- print("lvl up, player level: "+playerActualLevel);
- PlayerLevelUp();
- expNeededToLevelUp += 2*expNeededToLevelUp*playerActualLevel;
- print("exp required for level: " + (playerActualLevel + 1) + " is: "+expNeededToLevelUp);
- }
- PlayerSpellInput();
- }
- public void PlayerSpellInput()
- {
- if (Input.GetMouseButtonDown(0))
- {
- Attack();
- }
- if (Input.GetKeyDown(KeyCode.Alpha1))
- {
- Fire();
- }
- if (Input.GetKeyDown(KeyCode.Alpha2))
- {
- Ice();
- }
- if (Input.GetKeyDown(KeyCode.Alpha3))
- {
- Heal();
- }
- if (Input.GetKeyDown(KeyCode.Alpha4))
- {
- Ring();
- }
- }
- #region spells
- public void Attack()
- {
- if (attackCooldown <= 0f)
- {
- Instantiate(firebolt, gameObject.transform.position, gameObject.transform.rotation);
- attackCooldown = 0.75f;
- }
- else
- return;
- }
- public void Fire()
- {
- if (skillCooldown <= 0)
- {
- Instantiate(fireball, gameObject.transform.position, gameObject.transform.rotation);
- skillCooldown = 2f;
- }
- else
- return;
- }
- public void Ice()
- {
- if (skillCooldown <= 0)
- {
- Instantiate(fireball, gameObject.transform.position, gameObject.transform.rotation);
- skillCooldown = 2f;
- }
- else
- return;
- }
- public void Heal()
- {
- if (skillCooldown <= 0)
- {
- Instantiate(fireExplosion, gameObject.transform.position, gameObject.transform.rotation);
- skillCooldown = 2f;
- }
- else
- return;
- }
- public void Ring()
- {
- if (skillCooldown <= 0)
- {
- Instantiate(meteors, gameObject.transform.position, gameObject.transform.rotation);
- skillCooldown = 2f;
- }
- else
- return;
- }
- #endregion
- public void OnCollisionEnter(Collision col)
- {
- if (col.transform.CompareTag("Enemy"))
- {
- currentPlayerHealth -= outputdamage;
- if (currentPlayerHealth <= 0)
- {
- Debug.Log("health<0");
- //death animation +sound
- }
- }
- if (col.transform.CompareTag("Coin"))
- {
- Level_Manager.coins++;
- Destroy(col.gameObject);
- //put sound
- }
- }
- public void PlayerLevelUp()
- {
- StartingHealth += 20;
- print("startinghealth after lvl up" + StartingHealth);
- currentPlayerHealth = StartingHealth;
- print("actualhealth after lvl up" + currentPlayerHealth);
- StartingMana += 25;
- actuallMana = StartingMana;
- attackDamage += 10;
- print("attack damage after lvl" + attackDamage);
- }
- public void IncreaseStats(int id,int buff_amount,int buff_duration)
- {
- print("attackdamage" + attackDamage);
- attackDamage+= buff_amount;
- currentPlayerHealth += buff_amount;
- //STAT ID, BUFF amount, BUFF DURATION
- print("attackdamage after increase" + attackDamage);
- }
- }
Add Comment
Please, Sign In to add comment