private void OnAttack(AttackEvent attackEvent) { //Play the soundfor the attack if (PlaySound != null) { PlaySound(attackEvent.baseGO); } //Playt the particle for the attack if (PlayParticle != null) { PlayParticle(attackEvent.baseGO); } //Play the aanimation for the attack if (PlayAnimation != null) { PlayAnimation(attackEvent.baseGO); } if (attackEvent.baseGO.tag == "Player") { //Play sound //Run Animation? //Particle Effect? } else if (attackEvent.baseGO.tag == "Creature") { //Play sound //Run Animation? //Particle Effect? } else { Debug.LogError("DamageListener - The target object does not match any tags registered to take damage"); } }
private void OnDestroy() { AttackEvent.UnregisterListener(OnAttack); }
private void Start() { AttackEvent.RegisterListener(OnAttack); }