public override void Attack() { base.Attack(); //-- attack player ActorUtils.TriggerAttackAnimation(animator); //ActorUtils.Log(gameObject, "Attack"); if (preferredWeapon == null) { ActorUtils.Log(gameObject, "NoWeapon"); Debug.LogError("Enemy preferredWeapon must be defined"); } Transform player = GameplayManager.Instance.Player.transform; GameObject weapon = Instantiate(preferredWeapon, weaponSpawnPoint.position, Quaternion.identity); float shootingAngle = 30f; weapon.GetComponent <Rigidbody>().velocity = BallisticVelocity(player, shootingAngle); }
public virtual void TakeDamage(float amount, WeaponSO.DamageType damageType) { if (isDead) { return; } currentHealth -= amount; SetCurrentHealthText(); if (currentHealth <= 0) { Die(); } else // using ActorUtils to "take a hit" { //ActorUtils.Play(staticData.takeDamageAudio); //ActorUtils.TriggerTakeDamageAnimation(animator); ActorUtils.Log(gameObject, "TakeDamage [" + amount + "]"); } }