public void AddActor(Model.Actor actor, string displayName) { ActorInitiativeViewModel actorViewModel = ActorInitiativeViewModelFactory.GetActorViewModel(actor, this); actorViewModel.DisplayName = displayName; InitiativeCardViewModel initCardViewModel = InitiativeCardViewModelFactory.GetInitiativeCardViewModel(actorViewModel); AddInitiativeCard(initCardViewModel); }
public static InitiativeCardViewModel GetInitiativeCardViewModel(ActorInitiativeViewModel actorInitiativeViewModel) { if (actorInitiativeViewModel is PlayerActorInitiativeViewModel) { return(new PlayerActorInitiativeCardViewModel { ActorViewModel = actorInitiativeViewModel as PlayerActorInitiativeViewModel }); } else if (actorInitiativeViewModel.Actor is Model.Creature) { return(new CreatureInitiativeCardViewModel { ActorViewModel = actorInitiativeViewModel as CreatureInitiativeViewModel }); } else { throw new ArgumentException("Unknown type: " + actorInitiativeViewModel.GetType().ToString()); } }