using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BNG {
///
/// Attach this Component to any EmeraldAISystem object you wish to deal damage to.
///
public class EmeraldAILimbDamage : Damageable {
[SerializeField]
EmeraldAISystem.HitReaction HR;
EmeraldAISystem.LocationBasedDamageArea LD;
[SerializeField]
bool showHitFX = true;
private void Start() {
LD = GetComponent();
}
public override void DealDamage(float damageAmount, Vector3? hitPosition = null, Vector3? hitNormal = null, bool reactToHit = true, GameObject sender = null, GameObject receiver = null) {
Vector3 newHitPos = hitPosition == Vector3.zero ? transform.position : (Vector3)hitPosition;
LD.DamageArea((int)damageAmount, EmeraldAISystem.TargetType.Player, sender.transform, 400);
if (showHitFX) {
LD.CreateImpactEffect(newHitPos);
}
if (HR != null) {
HR.Hit(GetComponent(), -hitNormal.Value * 3, hitPosition.Value);
}
}
}
}