Exemple #1
0
    /// <summary>
    /// FireBallt kezeli, animáció + instantiate prefab + átadja a FireBallnak a játékoshoz képest a helyzetét.
    /// </summary>
    /// <returns></returns>
    IEnumerator FireBallCast()
    {
        ManaCounter.SubNumber(FireBallManaCost);
        AttackAnim.SetTrigger("SpellCast");
        timeBtwFireBalls = StartTimeBtwFireBalls;
        yield return(new WaitForSeconds(SpellCastTime));

        var go = Instantiate(fireballPrefab, fireballposition.position, transform.rotation);

        go.GetComponent <FireBallScript>().Player = gameObject;
    }
Exemple #2
0
    public void Healing(int healAmount, int manaCost)
    {
        if (ManaCounter.Number >= manaCost)
        {
            PlayerHealth.AddNumber(healAmount);

            ManaCounter.SubNumber(manaCost);
        }
    }
Exemple #3
0
 /// <summary>
 /// Ha van elég Gold, növeli az alap támadás sebzését és levonja az upgrade árát.
 /// </summary>
 public void PurchaseStandardAttackUpgrade()
 {
     if (CurrencyCounter.Number >= BaseAttackUpgradeCost)
     {
         PlayerAttackAsset.BaseAttackDamage += BaseAttackUpgrade;
         CurrencyCounter.SubNumber(BaseAttackUpgradeCost);
     }
 }
    /// <summary>
    /// regisztrálja a beérkezett sebzéseket, halál esetén "ragdoll"-t csinál az ellenfélből és félig randomizált irányba fellöki.
    /// </summary>
    /// <param name="damage"></param>
    public void TakeDamage(int damage)
    {
        health -= damage;
        if (health <= 0 && IsDead == false)
        {
            EnemyNumber.SubNumber();

            ManaCounter.AddNumber(manaWorth);

            CurrencyCounter.AddNumber(currencyWorth);


            Vector2 flightDirection = new Vector2(Random.Range(-0.5f, 0.5f), Random.Range(0.75f, 1.0f));
            GetComponent <EnemyMove>().enabled = false;
            rb2DAsset.constraints = RigidbodyConstraints2D.None;
            GetComponent <CircleCollider2D>().enabled = false;
            rb2DAsset.AddForce(flightDirection * thrust);
            rb2DAsset.gravityScale = 0.5f;
            IsDead = true;
            GetComponent <SpriteRenderer>().color = DeathColor;

            StartCoroutine(DeathBounce());
        }
    }
 public void StandardAttack(int damage)
 {
     PlayerHealth.SubNumber(damage);
 }