private IEnumerator SushiDiscoDanceDamage() { while (started) { Collider2D[] hitColliders = Physics2D.OverlapCircleAll(transform.position, sushiDiscoDanceRadius); foreach (Collider2D collider in hitColliders) { if (collider.gameObject.CompareTag(Tags.enemy)) { EnemyHealth enemyHealth = collider.gameObject.GetComponent <EnemyHealth>(); enemyHealth.CmdTakeDamage( DamageFormulas.CalculateBasicAttackDamage( (m_basic_attack_damage + m_basic_attack_damage * sushiDiscoDancePercentageDamageIncrease), enemyHealth.defense, ConstantsDictionary.randomK, AttackTypeMultiplierFactory.SelectAttackTypeMultiplier(m_attack_type, enemyHealth.type)), playerType, m_basic_attack_threat); } } yield return(new WaitForSeconds(ConstantsDictionary.SushiDiscoDanceDamageTick)); } }
private void OnTriggerEnter2D(Collider2D collision) { if (current_number_of_hits > 0) { if (collision.gameObject.CompareTag(Tags.enemy)) { bool inComboField = false; current_number_of_hits--; EnemyHealth enemyHealth = collision.gameObject.GetComponent <EnemyHealth>(); if (enemyHealth != null) { float basicAttackDamage = parent.m_basic_attack_damage; if (parent.isInOctoComboField) { basicAttackDamage += basicAttackDamage * ConstantsDictionary.octoComboIncreasedDamagePercentage; inComboField = true; } float damage = DamageFormulas.CalculateBasicAttackDamage(basicAttackDamage, enemyHealth.defense, ConstantsDictionary.randomK, AttackTypeMultiplierFactory.SelectAttackTypeMultiplier(parent.m_attack_type, enemyHealth.type)); float threat; if (parent.isInFishermanComboField) { threat = ConstantsDictionary.reducedComboFieldThreat; inComboField = true; } else { threat = parent.m_basic_attack_threat; } enemyHealth.CmdTakeDamage(damage, ConstantsDictionary.PLAYERS.neko, threat); if (parent == null) { parent = GetComponentInParent <NekoMaidAttacks>(); } if (nekoHealth == null) { nekoHealth = GetComponent <PlayerHealth>(); } //se ho attivato la skill passiva kawaii dello skill tree della neko if (parent.kawaiiPercentageOfDamageInHp > 0 && nekoHealth.currentHealth > 0) { nekoHealth.Heal(damage * parent.kawaiiPercentageOfDamageInHp); } //se ho attivato sharing is caring tutti gli altri player ricevono //una percentuale di danni della neko in hp if (parent.sharingIsCaringActivated) { foreach (GameObject player in otherPlayers) { PlayerHealth health = player.GetComponent <PlayerHealth>(); if (health.currentHealth > 0) { CmdHeal(nekoHealth.gameObject, damage * parent.sharingIsCaringPercentageOfDamageInHp); //health.Heal(damage * parent.sharingIsCaringPercentageOfDamageInHp); } } } if (inComboField) { parentController.IncreaseUltimateCharge(ConstantsDictionary.ultiIncreaseForCombo); } else { parentController.IncreaseUltimateCharge(ConstantsDictionary.ultiIncreaseForBasicAttack); } } } } }
private void OnTriggerEnter2D(Collider2D collision) { if (current_number_of_hits > 0) { if (collision.gameObject.CompareTag(Tags.enemy)) { bool inComboField = false; current_number_of_hits--; float basicAttackDamage = parent.m_basic_attack_damage; if (parent.isInOctoComboField) { basicAttackDamage += basicAttackDamage * ConstantsDictionary.octoComboIncreasedDamagePercentage; inComboField = true; } EnemyHealth enemyHealth = collision.gameObject.GetComponent <EnemyHealth>(); if (enemyHealth != null) { float damageDealt = DamageFormulas.CalculateBasicAttackDamage(basicAttackDamage, enemyHealth.defense, ConstantsDictionary.randomK, AttackTypeMultiplierFactory.SelectAttackTypeMultiplier(parent.m_attack_type, enemyHealth.type)); enemyHealth.CmdTakeDamage(damageDealt, parent.playerType, parent.m_basic_attack_threat); if (parent.isInNekoComboField && parentHealth.currentHealth > 0) { float healAmount = damageDealt * ConstantsDictionary.nekoComboRecoveredHpPercentage; CmdHeal(parent.gameObject, healAmount); inComboField = true; } } if (inComboField) { parentController.IncreaseUltimateCharge(ConstantsDictionary.ultiIncreaseForCombo); } else { parentController.IncreaseUltimateCharge(ConstantsDictionary.ultiIncreaseForBasicAttack); } } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag(Tags.enemy)) { if (enemiesStillToHit > 0 && !collision.gameObject.Equals(firstHitEnemy)) { bool inComboField = false; enemiesStillToHit--; firstHitEnemy = collision.gameObject; EnemyHealth enemyHealth = collision.gameObject.GetComponent <EnemyHealth>(); if (enemyHealth != null) { float damageDealt = DamageFormulas.CalculateBasicAttackDamage(damage, enemyHealth.defense, ConstantsDictionary.randomK, AttackTypeMultiplierFactory.SelectAttackTypeMultiplier(attackType, enemyHealth.type)); float threat; if (inFishermanComboField) { threat = ConstantsDictionary.reducedComboFieldThreat; inComboField = true; } else { threat = ConstantsDictionary.OctoChefBasicAttackThreat; } enemyHealth.CmdTakeDamage(damageDealt, ConstantsDictionary.PLAYERS.octo, threat); if (inNekoMaidComboField && octoHealth.currentHealth > 0) { float healAmount = damageDealt * ConstantsDictionary.nekoComboRecoveredHpPercentage; octoHealth.Heal(healAmount); inComboField = true; } } if (inComboField) { playerController.IncreaseUltimateCharge(ConstantsDictionary.ultiIncreaseForCombo); } else { playerController.IncreaseUltimateCharge(ConstantsDictionary.ultiIncreaseForBasicAttack); } } if (enemiesStillToHit == 0) { NetworkServer.Destroy(gameObject); } } if (collision.gameObject.CompareTag(Tags.building)) { NetworkServer.Destroy(gameObject); } }