virtual public void BeginAttack(Damage damageToDeal, Fighter attacker) { weaponUser = attacker; attackCast.OnHit += OnWeaponHit; damageOut = damageToDeal; attackCast.Begin(); }
public void Fire(float velocity, float secondsToDeath, Vector3 direction, Damage damage, float damageScalar, Team shooterTeam) { team = shooterTeam; damageOut = damage; attackCast.OnHit += OnProjectileHit; attackCast.Begin(); keepAlive = false; startingTime = Time.time; lifeTime = secondsToDeath; projectileBody.AddForce(direction * velocity); damageScale = damageScalar; }
void SetAttackActive(bool isActive) { if (attackCaster != null) { if (isActive) { attackCaster.Begin(currentAttack); } else { attackCaster.End(); } } }
/// <summary> /// Starts the attack, activating the cast if needed, playing the animation, and starting /// timer for the attack. /// </summary> /// <param name="attackToStart">Attack to start.</param> void StartAttack (AttackData attackToStart) { // TODO This is bad practice. When we refactor this, let's properly enapsulate // the current attack in one of these classes. enemy.currentAttack = attackToStart; attackAnimation.Play (attackToStart.swingAnimation.name); if (!attackToStart.IsRanged ()) { attackCaster.OnHit += OnAttackHit; attackCaster.Begin (); trailRenderer.enabled = true; } attackTime.StartTimer (attackToStart.swingAnimation.length); isAttacking = true; }
/// <summary> /// Begin the sweep for damageable objects on the current attack /// </summary> public void StartAttackCast() { // TODO Consolidate this and the StartAttack for each enemy AI. // Ignore events that occur while blending out of Attack. if (usesAnimation) { bool isTransitioningToNonAttackState = animator.IsInTransition(0) && !animator.GetNextAnimatorStateInfo(0).IsName("Base Layer.Attack"); if (isTransitioningToNonAttackState) { return; } } attackCaster.OnHit += OnAttackHit; attackCaster.Begin(); }