public override void Attack(Character target, EnemyCharacterStatusInfo statusInfo) { if (Time.timeSinceLevelLoad < nextAttackTime) { return; } if (target == null) { return; } nextAttackTime = Time.timeSinceLevelLoad + _typedInfo.BaseAttackSpeed; //if ( character.Status.GetHitChance() < 100.Random() ) { // Debug.Log( "Miss!" ); // return; //} target.Damage(_typedInfo.BaseDamage); //if ( character.Status.GetCriticalHitChance( target.Status ) > 100.Random() ) { // Debug.Log( "Critical hit!" ); // target.Damage( character.Status.GetMeleeAttack( info.damage ) * 5 / 3, ignoreArmor: true ); //} else { // target.Damage( character.Status.GetMeleeAttack( info.damage ) ); //} //Debug.Log( character.Status.GetAttackDelay( info.attackDuration ) ); }
public override void Attack(Character target, EnemyCharacterStatusInfo statusInfo) { if (target == null || !IsAttackAvailable) { return; } if (AttackAction != null) { AttackAction(); } for (var i = 0; i < _typedInfo._projectilesPerShot; ++i) { var projectile = GetProjectileInstance(); var targetDirection = (target.Pawn.position - Character.Pawn.position).Set(y: 0).normalized; AttackDirection = targetDirection; var projectileDirection = GetOffsetDirection(targetDirection, i); var finalDamage = ModifierCalculator.CalculateFinalValue(ModifierType.BaseDamage, _typedInfo.BaseDamage); projectile.Launch(Character, projectileDirection, _typedInfo._projectileSpeed, finalDamage, _typedInfo.CanFriendlyFire, _typedInfo._splashDamageRadius); if (_behaviour.TryShoot()) { AmmoInClip -= ClipSize; } if (_behaviour.IsReloading) { break; } } var sound = _typedInfo._sounds.RandomElement(); if (sound != null) { AudioSource.PlayClipAtPoint(sound, Character.Pawn.position, 0.5f); } }
public virtual void Attack(Character target, EnemyCharacterStatusInfo statusInfo) { }