Beispiel #1
0
 public static ActorInitiativeViewModel GetActorViewModel(Model.Actor actor, EncounterViewModel encounterViewModel)
 {
     if (actor is Model.PlayerActor)
     {
         return(new PlayerActorInitiativeViewModel(actor as Model.PlayerActor));
     }
     else if (actor is Model.Creature)
     {
         return(new CreatureInitiativeViewModel(actor as Model.Creature, encounterViewModel));
     }
     else
     {
         throw new ArgumentException("Unknown type: " + actor.GetType().ToString());
     }
 }
 public void UpdateActor(Model.Actor updatedActor)
 {
     foreach (InitiativeCardViewModel initCard in InitiativeTrack)
     {
         if (initCard.ActorViewModel.Actor.ActorName == updatedActor.ActorName &&
             initCard.ActorViewModel.Actor.GetType() == updatedActor.GetType())
         {
             if (initCard.ActorViewModel is PlayerActorInitiativeViewModel)
             {
                 PlayerActorInitiativeViewModel newViewModel = new PlayerActorInitiativeViewModel(updatedActor as Model.PlayerActor);
                 newViewModel.DisplayName = initCard.ActorViewModel.DisplayName;
                 (initCard as PlayerActorInitiativeCardViewModel).ActorViewModel = newViewModel;
             }
         }
     }
 }