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 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); }