public ActionResult DeleteConfirmed(int id) { Achieved achieved = db.Achievements.Find(id); db.Achievements.Remove(achieved); db.SaveChanges(); return(RedirectToAction("Index")); }
private void AchievementAchieved(IAchievement achievement, bool firstTime) { Achieved?.Invoke(achievement, firstTime); foreach (IAchievement iter in Achievements.Where(x => x.IsAchievable)) { iter.OnAchievementEarned(achievement, Achievements); } }
public ActionResult Edit([Bind(Include = "id,title,content,createdAt")] Achieved achieved) { if (ModelState.IsValid) { db.Entry(achieved).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(achieved)); }
public ActionResult Create([Bind(Include = "id,title,content")] Achieved achieved) { if (ModelState.IsValid) { db.Achievements.Add(achieved); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(achieved)); }
// GET: Achieveds/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Achieved achieved = db.Achievements.Find(id); if (achieved == null) { return(HttpNotFound()); } return(View(achieved)); }
public override void Update(float dt) { if ((Player.transform.position - Destination).magnitude < 1) { if (Achieved != null) { Achieved.Invoke(Player, this); } return; } Player.LookAt(Destination - Player.transform.position); Player.AddMoveBehavior(Destination - Player.transform.position); base.Update(dt); }
public virtual void Achieve() { bool firstTime = false; DateTime now = DateTime.Now; if (!IsAchieved) { FirstTimeAchieved = now; firstTime = true; } LastTimeAchieved = now; IsAchieved = true; AchieveCount++; Reset(); AlreadyAchievedThisGame = true; Achieved?.Invoke(this, firstTime); }
private void MoveGoal_Achieved(Player player, Goal goal) { this.SubGoals.Remove(goal); if (this.Path.Count > 0) { Path.RemoveAt(0); } if (Path.Count <= 0) { if (Achieved != null) { Achieved.Invoke(Player, this); } return; } var moveGoal = new MoveTo(Player, Path[0].transform.position); moveGoal.Achieved += MoveGoal_Achieved; this.AddSubGoal(moveGoal); }
/// <summary> /// Use to notify the achievement state change. /// </summary> protected void NotifyAchieved() { // Push the achivement state MySteam.API.SetAchievement(AchievementTag); // DEBUG HELPER if (MySteamAchievements.OFFLINE_ACHIEVEMENT_INFO) { MyAPIGateway.Utilities.ShowNotification("Achievement Unlocked: " + AchievementTag, 10000, MyFontEnum.Red); } IsAchieved = true; // Invoke event and clear the invocation list if (Achieved != null) { Achieved(this); foreach (var @delegate in Achieved.GetInvocationList()) { Achieved -= (Action <MySteamAchievementBase>)@delegate; } } }