private void HandlePlayerAttack() { if (GameManager.Instance.CurrentState != GameStates.BATTLING) { return; } currentAttackCharge += attackSpeed * PLAYER_CONTROL_SPEED_MULT; energySlider.value = currentAttackCharge / AttackTime; if (energySlider.value >= 1.0f) { if (target != null && target.isAlive && isAlive) { animator.SetTrigger("Attack"); target.Damage(attackDamage); audioSource.clip = attackSound; audioSource.Play(); currentAttackCharge = 0.0f; energySlider.value = currentAttackCharge / AttackTime; } } }
private void OnParticleCollision(GameObject other) { if (other.CompareTag("Troop")) { if (other.name.Contains("ContainerTroop") && !other.name.Contains("InsideContainerTroop")) { if (!(other.gameObject.GetComponent <ContainerTroop>().containerBroken)) { Troop enemy = other.GetComponent <Troop>(); enemy.Damage(0.07f); } } else { Troop enemy = other.GetComponent <Troop>(); enemy.Damage(0.07f); } } }