Example #1
0
 // Use this for initialization
 void Start()
 {
     damage        = 25;
     arrowSpeed    = 15;
     myTransform   = transform;
     rotationSpeed = -100;
     sprite        = GetComponent <SpriteRenderer>();
     atkInfo       = new InfAtk(damage, gameObject.tag);
     arrowSpeed    = 15.0f;
 }
Example #2
0
    public override void TakeDamage(GameObject attacker, float damage, InfAtk inf, TypeDamage typeDamage)
    {
        int realDamage = 0;

        if (!die)
        {
            // Subtract the armor value
            if (typeDamage == TypeDamage.physic)
            {
                // Subtract the armor value
                // formula do lol 100/100+armadura e o dano é dividio por essa formula, assim se eu tiver 50 de armadura vou receber 2/3 de dano
                realDamage = (int)(damage * DefeseValue(armor));
                realDamage = Mathf.Clamp(realDamage, 0, int.MaxValue);
            }
            else
            {
                realDamage = (int)damage;
            }

            // Damage the character
            health.CurrentVal -= realDamage;
            if (realDamage > 0)
            {
                if (inf == InfAtk.normal)
                {
                    //CombatText.print
                    CombatTextManager.Instance.AttackText(transform, realDamage);
                }
                else if (inf == InfAtk.critic)
                {
                    CombatTextManager.Instance.CriticText(transform, realDamage);
                }
            }
            else
            {
                CombatTextManager.Instance.MissText(transform);
            }



            // If health reaches zero
            if (health.CurrentVal <= 0)
            {
                Die(attacker);
            }
        }
    }
Example #3
0
    public virtual void takeDamage(InfAtk atkInfo)
    {
        if (status.GetHp() > 0)
        {
            status.SetHp(status.GetHp() - atkInfo.damage);
            if (atkInfo.playerTag == "Player1")
            {
                playersDamage[0] += atkInfo.damage;
            }
            if (atkInfo.playerTag == "Player2")
            {
                playersDamage[1] += atkInfo.damage;
            }
            if (atkInfo.playerTag == "Player3")
            {
                playersDamage[2] += atkInfo.damage;
            }
            if (atkInfo.playerTag == "Player4")
            {
                playersDamage[3] += atkInfo.damage;
            }

            hitted = 3;
            if (status.GetHp() <= 0)
            {
                anim.SetBool("dead", true);
                dead = true;
                var aux = camera.GetComponent <AudioSource>();
                aux.Stop();
                aux.clip = fanfare;
                aux.PlayOneShot(fanfare, 0.7f);
                source.Stop();
                source.clip = kahalDying;
                source.PlayOneShot(kahalDying, 0.7f);
                PlayerPrefs.SetInt("Player1", playersDamage[0]);
                PlayerPrefs.SetInt("Player2", playersDamage[1]);
                PlayerPrefs.SetInt("Player3", playersDamage[2]);
                PlayerPrefs.SetInt("Player4", playersDamage[3]);

                Invoke("CarregarCenaVitoria", 4.7f);
            }
        }
    }
Example #4
0
 // Damage the character
 public abstract void TakeDamage(GameObject attacker, float damage, InfAtk inf, TypeDamage typeDamage);
Example #5
0
 void Start()
 {
     myTransform = transform;
     pos         = myTransform.position;
     atkInfo     = new InfAtk(damage, gameObject.tag);
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     atkInfo = new InfAtk(damage, gameObject.tag);
 }
Example #7
0
 // Use this for initialization
 void Start()
 {
     myTransform = transform;
     atkInfo     = new InfAtk(damage, gameObject.tag);
 }