private void IntarectionBus_NewEvent(object?sender, ActorInteractionEventArgs e) { if (e.ActorInteractionEvent is DamageActorInteractionEvent damageActorInteractionEvent) { var actDescription = damageActorInteractionEvent.UsedActDescription; var targetPerson = damageActorInteractionEvent.TargetActor.Person; var soundEffect = _personSoundContentStorage.GetActHitSound(actDescription, targetPerson); soundEffect.CreateInstance().Play(); } }
private void IntarectionBus_NewEvent(object?sender, ActorInteractionEventArgs e) { if (e.ActorInteractionEvent is DamageActorInteractionEvent damageActorInteractionEvent) { var actDescription = damageActorInteractionEvent.UsedActDescription; var targetActor = damageActorInteractionEvent.TargetActor; var attackerViewModel = ViewModelContext.GameObjects.OfType <ActorViewModel>() .Single(x => x.Actor == damageActorInteractionEvent.Actor); if (attackerViewModel.CanDraw) { attackerViewModel.RunCombatActUsageAnimation(actDescription, targetActor.Node); } var targetViewModel = ViewModelContext.GameObjects.OfType <ActorViewModel>() .Single(x => x.Actor == targetActor); if (targetViewModel.CanDraw) { var targetPersonIsStillAlive = !targetActor.Person.CheckIsDead(); if (targetPersonIsStillAlive) { targetViewModel.RunDamageReceivedAnimation(attackerViewModel.Node); } } } else if (e.ActorInteractionEvent is DodgeActorInteractionEvent dodgeActorInteractionEvent) { var actDescription = dodgeActorInteractionEvent.UsedActDescription; var targetActor = dodgeActorInteractionEvent.TargetActor; var attackerViewModel = ViewModelContext.GameObjects.OfType <ActorViewModel>() .Single(x => x.Actor == dodgeActorInteractionEvent.Actor); if (attackerViewModel.CanDraw) { attackerViewModel.RunCombatActUsageAnimation(actDescription, targetActor.Node); } } else if (e.ActorInteractionEvent is PureMissActorInteractionEvent pureMissActorInteractionEvent) { var actDescription = pureMissActorInteractionEvent.UsedActDescription; var targetActor = pureMissActorInteractionEvent.TargetActor; var attackerViewModel = ViewModelContext.GameObjects.OfType <ActorViewModel>() .Single(x => x.Actor == pureMissActorInteractionEvent.Actor); if (attackerViewModel.CanDraw) { attackerViewModel.RunCombatActUsageAnimation(actDescription, targetActor.Node); } } }
private void EventMessageBus_NewEvent(object sender, ActorInteractionEventArgs e) { RaisedActorInteractionEvents.Add(e.ActorInteractionEvent); }