public virtual void OnAvatarAttack(Avatar.Attack attack) { // Debug.Log ("Avatar Attacked Enemy"); Avatar.attackListenerList.Remove(this); DetermineWaitTime(attack); this.takeDamage(1); }
private void FireAttackActionEvent(Avatar.Attack attack) { if (slashSound != null && attackListenerList.Count == 0) { AudioSource.PlayClipAtPoint(slashSound, transform.position); } for (int i = attackListenerList.Count - 1; i >= 0; i--) { attackListenerList[i].OnAvatarAttack(attack); } }
/// <summary> /// Launches the bird towards the right /// </summary> public void OnAvatarAttack(Avatar.Attack attack) { if (angryBirdSound != null) { AudioSource.PlayClipAtPoint(angryBirdSound, transform.position); } Avatar.attackListenerList.Remove(this); // Launched bird should be affected by physics rigidbody2D.gravityScale = 2; rigidbody2D.AddForce(new Vector3(1500, 5000)); PrepareProximityBomb(); Destroy(gameObject, 1); }
protected void DetermineWaitTime(Avatar.Attack attack) { switch (attack) { case Avatar.Attack.JUMPSWIPE: wait = 0.3f; break; case Avatar.Attack.LOWSWIPE: wait = 0.2f; break; case Avatar.Attack.JUMPSTOMP: wait = 0.5f; break; case Avatar.Attack.OVERHEADSWIPE: wait = 0.2f; break; default: break; } }
public void OnAvatarAttack(Avatar.Attack attack) { takeDamage(1); }
public void OnAvatarAttack(Avatar.Attack attack) { }
public override void OnAvatarAttack(Avatar.Attack attack) { // Debug.Log ("Avatar Attacked Enemy"); if (this == null) { Avatar.attackListenerList.Remove(this); return; } if (shielded) { switch (attack) { case Avatar.Attack.JUMPSTOMP: case Avatar.Attack.JUMPSWIPE: case Avatar.Attack.OVERHEADSWIPE: if (shieldPosition == ShieldPosition.Top) { if (littleClashSound != null && shieldType == ShieldType.Short) { AudioSource.PlayClipAtPoint(littleClashSound, transform.position); } if (bigClashSound != null && shieldType == ShieldType.Tall) { AudioSource.PlayClipAtPoint(bigClashSound, transform.position); } return; } break; case Avatar.Attack.PIERCE: if (shieldType == ShieldType.Tall || shieldPosition == ShieldPosition.Middle) { if (littleClashSound != null && shieldType == ShieldType.Short) { AudioSource.PlayClipAtPoint(littleClashSound, transform.position); } if (bigClashSound != null && shieldType == ShieldType.Tall) { AudioSource.PlayClipAtPoint(bigClashSound, transform.position); } return; } break; case Avatar.Attack.LOWSWIPE: if (shieldPosition == ShieldPosition.Bottom) { if (littleClashSound != null && shieldType == ShieldType.Short) { AudioSource.PlayClipAtPoint(littleClashSound, transform.position); } if (bigClashSound != null && shieldType == ShieldType.Tall) { AudioSource.PlayClipAtPoint(bigClashSound, transform.position); } return; } break; } } Avatar.attackListenerList.Remove(this); DetermineWaitTime(attack); this.takeDamage(1); }