} //endast med armor i åtanke public bool AddHealth(int h, TypeDamage damageType) //armor type + armor i åtanke! { if (isAlive == false) { return(false); } bool positiveHealth = false; if (h > 0) { positiveHealth = true; } float efficiency = damageHandler.GetDamageEfficiency(damageType, armorType); h = (int)((float)h * efficiency); if (positiveHealth) //så att man inte gör 0 { h = Mathf.Max(1, h); } else { h = Mathf.Min(-1, h); } return(AddHealth(h)); }
public void BurningDamage(GameObject attacker, float damage, TypeDamage typeDamage, float cowndown) { activeTemp = true; if (temp >= cowndown) { TakeDamage(attacker, damage, InfAtk.normal, typeDamage); temp = 0; } }
public virtual void Spawn(Vector3 pos) { AddHealth(); maxHP = infoEnemy.MaxHP; hp = maxHP; moveSpeed = infoEnemy.MoveSpeed; armor = infoEnemy.Armor; resist = infoEnemy.resist; AddHealth(); }
public void Spawn(Vector3 position) { pos.position = position; damage = infoTower.damage; attakSpeed = infoTower.attakSpeed; attakRange = infoTower.attakRange; typeTower = infoTower.typeTower; typeAttak = infoTower.typeAttak; render.material = standart; sound = GetComponent <AllSounds>(); sound.AddSound(); creation = false; AddCell((int)position.x, (int)position.y); }
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); } } }
public override void Fire(Transform target, Vector3 aimPos, int damage, float lifeTime, bool notifyattacked, bool ff, TypeDamage dmgType) { StopAllCoroutines(); ToggleActive(true); aimPosition = aimPos; thisTransform.LookAt(aimPosition); targetE = target; thisRigidbody.AddForce(thisTransform.forward * shootForce, ForceMode.Impulse); notifyAttacked = notifyattacked; friendlyFire = ff; damageRoll = damage; damageType = dmgType; startAliveTime = Time.time; StartCoroutine(LifeTime(lifeTime)); }
public void Damage(float value, TypeDamage type) { float damage = 0; if (type == TypeDamage.physic) { damage = value * (1 - 0.06f * armor / (1 + (0.06f * Mathf.Abs(armor)))); } else { damage = resist == type ? value / 2 : value; } if (hp - damage <= 0) { hp = 0; Dead(); } else { hp -= damage; } }
public float GetDamageEfficiency(TypeDamage damageType, TypeArmor armorType) { switch (damageType) { case TypeDamage.Slicing: return(GetDamageEfficiencySlicing(armorType)); case TypeDamage.Blunt: return(GetDamageEfficiencyBlunt(armorType)); case TypeDamage.Piercing: return(GetDamageEfficiencyPiercing(armorType)); case TypeDamage.Magic: return(GetDamageEfficiencyMagic(armorType)); case TypeDamage.Siege: return(GetDamageEfficiencySiege(armorType)); default: return(1.0f); } }
public string GetDamageToolTip(TypeDamage tA) { switch (tA) { case TypeDamage.Slicing: return(slicingDamage_ToolTip); case TypeDamage.Blunt: return(bluntDamage_ToolTip); case TypeDamage.Piercing: return(piercingDamage_ToolTip); case TypeDamage.Magic: return(magicDamage_ToolTip); case TypeDamage.Siege: return(siegeDamage_ToolTip); default: Debug.Log("Ej fastställd TypeArmor"); return(""); } }
public Sprite GetDamageSprite(TypeDamage tD) { switch (tD) { case TypeDamage.Slicing: return(slicingDamageSprite); case TypeDamage.Blunt: return(bluntDamageSprite); case TypeDamage.Piercing: return(piercingDamageSprite); case TypeDamage.Magic: return(magicDamageSprite); case TypeDamage.Siege: return(siegeDamageSprite); default: Debug.Log("Ej fastställd TypeDamage"); return(defaultSprite); } }
// Damage the character public abstract void TakeDamage(GameObject attacker, float damage, InfAtk inf, TypeDamage typeDamage);