Exemplo n.º 1
0
 public void AddSampleAction()
 {
     Gnome gnome = GnomeRepository.GetByIdIncludeActions(1);
     ActionPattern pattern = new ActionPattern { Name = "Default", BaseDuration = 10 };
     Cell cell = CellRepository.GetByCoord(1, 0, 0);
     GnomeAction gnomeActionToAdd = new GnomeAction { ActionPattern = pattern, Name = "DigAction", TargetCell = cell};
     GnomeAction last = GnomeActionRepository.FindLastGnomeAction(1);
     GnomeActionService gnomeActionService = new GnomeActionService();
     gnomeActionService.AddActionToEnd(gnome, gnomeActionToAdd, last);
     GnomeRepository.UnitOfWork.SaveChanges();
 }
 public void AddActionToEnd(Gnome gnome, GnomeAction actionToAdd, GnomeAction lastAction)
 {
     gnome.GnomeActions.Add(actionToAdd);
     actionToAdd.PreviousAction = lastAction;
 }