예제 #1
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);
            }
        }
예제 #2
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);
 }
예제 #3
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);
        }
예제 #4
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);
        }