public void FeedAnimal(Pet p, Action feed) { try { p.FeedAnimal(feed); ActionsHistory newAction = this.ActionsHistories.CreateProxy(feed, p); //newAction.UserName = UIMain.CurrentPlayer.UserName; //newAction.StatusId = p.StatusId; //newAction.PetAge = p.PetAge; //newAction.ActionTime = DateTime.Now; // newAction.LifeCycle = p.LifeCycle; // newAction.HungerLevel = p.HungerLevel; //newAction.HygieneLevel = p.HygieneLevel; //newAction.HappinesLevel = p.HappinesLevel; ////newAction.UserName = p.UserName; p.ActionsHistories.Add(newAction); this.SaveChanges(); } catch (Exception e) { } }
public void Play(Pet p, Action play) { try { p.Play(play); //p.HappinesLevel += play.ActionEffection; //if (p.HappinesLevel > 5) // p.HappinesLevel = 5; ActionsHistory action = this.ActionsHistories.CreateProxy(play, p); //action.StatusId = p.StatusId; //action.PetAge = p.PetAge; //action.ActionTime = DateTime.Now; //action.LifeCycle = p.LifeCycle; //action.HungerLevel = p.HungerLevel; //action.HygieneLevel = p.HygieneLevel; //action.HappinesLevel = p.HappinesLevel; //action.UserName = p.UserName; p.ActionsHistories.Add(action); this.SaveChanges(); } catch (Exception e) { } }
public void AddActionHistory(ActionsHistory ah) { try { this.ActionsHistories.Add(ah); } catch (Exception e) { Console.WriteLine("somthing went wrong{0}", e); } }