// Health regeneration
 void UpdateVigor()
 {
     if (RegenerationTimeRemaining > 0)
     {
         healthScript.Heal(VigorRegenRate);
     }
 }
示例#2
0
 private void TryHealOther(GameObject other)
 {
     if (OtherHasCorrectTag(other))
     {
         HealthScript hs = other.GetComponent <HealthScript>();
         if (hs != null)
         {
             hs.Heal(healAmount);
         }
     }
 }
示例#3
0
    public void UpgradePlayerHealth()
    {
        if (_playerHealthScript.currentHealth >= playerHealthMax || GameManager.Instance.seedOilAmount < playerHealthUpgradeCost)
        {
            return;
        }

        GameManager.Instance.UpdateSeedOilAmount(-playerHealthUpgradeCost);
        _playerHealthScript.Heal(playerHealthUpgradeValue);

        if (playerHealthBar)
        {
            playerHealthBar.fillAmount = (float)_playerHealthScript.currentHealth / playerHealthMax;
        }
    }
 //Ez a currentHealth-et változtatja, nem a maxHealth-et! tehát egy healthPickup ezt hívja meg
 public void HealPlayer(int plusHealth)
 {
     myHealthScript.Heal(plusHealth);
 }
示例#5
0
    public void SpellCast()
    {
        if (isDead == false && mana.mana > 0)
        {
            if (Input.GetKeyDown(KeyCode.Alpha1) && Time.time > nextAutoSpell && isWalking == false)
            {
                audioS.PlayOneShot(BasicAttackSound, 0.1f);

                mana.TakeMana(1);
                nextAutoSpell = Time.time + coolDown;
                var cloneEffect = Instantiate(basicAttackEffect, Staff.transform.position, Staff.transform.rotation);
                var clone       = Instantiate(basicAttack, Staff.transform.position, Staff.transform.rotation);
                clone.GetComponent <Rigidbody>().velocity = transform.forward * 25f;
                isCastingSpell = true;
                anim.Stop("free");
                anim.Play("attack");
                Destroy(clone, 0.5f);
                Destroy(cloneEffect, 1.5f);
            }
            if (Input.GetKeyDown(KeyCode.Alpha2) && Time.time > nextHeal && isWalking == false && ExperienceScript.isHealTrained == true)
            {
                audioS.PlayOneShot(HealSound);

                mana.TakeMana(15);
                health.Heal(10, 20);
                nextHeal = Time.time + coolDown + 10;
                var clone = Instantiate(spells[0], healPoint.transform.position, Quaternion.identity);
                clone.GetComponent <Transform>().Rotate(-180, 0, 0);
                clone.transform.parent = transform;
                Destroy(clone, 4);
                isCastingSpell = true;
                anim.Stop("free");
                anim.Play("skill");
            }
            if (Input.GetKeyDown(KeyCode.Alpha3) && Time.time > nextDeadlyBreath && isWalking == false && PlayerLevel.level >= 10)
            {
                mana.TakeMana(25);
                nextDeadlyBreath = Time.time + coolDown + 20;
                var clone = Instantiate(DeadlyBreath, new Vector3(transform.position.x, transform.position.y + 1.5f, transform.position.z), transform.rotation);
                clone.GetComponent <Transform>().Rotate(90, 0, 0);
                clone.transform.parent = transform;
                Destroy(clone, 2.5f);
                isCastingSpell = true;
                anim.Stop("free");
                anim.Play("skill");
            }
            if (Input.GetKeyDown(KeyCode.Alpha4) && isWalking == false && PlayerLevel.level >= 15)
            {
                audioS.PlayOneShot(TotemSpawnSound);
                var clone = Instantiate(AirTotem, AirTotemSpawn.transform.position, AirTotemSpawn.transform.rotation);
                Destroy(clone, 60);
                isCastingSpell = true;
                anim.Stop("free");
                anim.Play("skill");
            }
            if (Input.GetKeyDown(KeyCode.Alpha5) && isWalking == false && PlayerLevel.level >= 16)
            {
                audioS.PlayOneShot(TotemSpawnSound);

                var clone = Instantiate(WaterTotem, WaterTotemSpawn.transform.position, WaterTotemSpawn.transform.rotation);
                Destroy(clone, 60);
                isCastingSpell = true;
                anim.Stop("free");
                anim.Play("skill");
            }
            if (Input.GetKeyDown(KeyCode.Alpha6) && isWalking == false && PlayerLevel.level >= 17)
            {
                audioS.PlayOneShot(TotemSpawnSound);

                var clone = Instantiate(EarthTotem, EarthTotemSpawn.transform.position, EarthTotemSpawn.transform.rotation);
                Destroy(clone, 60);
                isCastingSpell = true;
                anim.Stop("free");
                anim.Play("skill");
            }
            if (Input.GetKeyDown(KeyCode.Alpha7) && isWalking == false && PlayerLevel.level >= 18)
            {
                audioS.PlayOneShot(TotemSpawnSound);

                var clone = Instantiate(FireTotem, FireTotemSpawn.transform.position, FireTotemSpawn.transform.rotation);
                Destroy(clone, 60);
                isCastingSpell = true;
                anim.Stop("free");
                anim.Play("skill");
            }

            if (PlayerLevel.level < 3 && Input.GetKeyDown(KeyCode.Alpha2) && isTextOn == false)
            {
                isTextOn            = true;
                warningText.enabled = true;
                warningText.text    = "Level 3 required for this magic!";
            }
            if (PlayerLevel.level < 10 && Input.GetKeyDown(KeyCode.Alpha3) && isTextOn == false)
            {
                isTextOn            = true;
                warningText.enabled = true;
                warningText.text    = "Level 10 required for this magic!";
            }
            if (PlayerLevel.level < 15 && Input.GetKeyDown(KeyCode.Alpha4) && isTextOn == false)
            {
                isTextOn            = true;
                warningText.enabled = true;
                warningText.text    = "Level 15 required for this magic!";
            }
            if (PlayerLevel.level < 16 && Input.GetKeyDown(KeyCode.Alpha5) && isTextOn == false)
            {
                isTextOn            = true;
                warningText.enabled = true;
                warningText.text    = "Level 16 required for this magic!";
            }
            if (PlayerLevel.level < 17 && Input.GetKeyDown(KeyCode.Alpha6) && isTextOn == false)
            {
                isTextOn            = true;
                warningText.enabled = true;
                warningText.text    = "Level 17 required for this magic!";
            }
            if (PlayerLevel.level < 18 && Input.GetKeyDown(KeyCode.Alpha7) && isTextOn == false)
            {
                isTextOn            = true;
                warningText.enabled = true;
                warningText.text    = "Level 18 required for this magic!";
            }
        }
    }