Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Achieved achieved = db.Achievements.Find(id);

            db.Achievements.Remove(achieved);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        private void AchievementAchieved(IAchievement achievement, bool firstTime)
        {
            Achieved?.Invoke(achievement, firstTime);

            foreach (IAchievement iter in Achievements.Where(x => x.IsAchievable))
            {
                iter.OnAchievementEarned(achievement, Achievements);
            }
        }
Ejemplo n.º 3
0
 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));
 }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        // 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));
        }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        /// <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;
                }
            }
        }