void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { ownRenderer.enabled = true; completed = true; if (OnObjectiveCompleted != null) { OnObjectiveCompleted.Invoke(); } } }
public void CompleteObjective(string descriptionText, string counterText, string notificationText) { IsCompleted = true; ObjectiveUpdateEvent evt = Events.ObjectiveUpdateEvent; evt.Objective = this; evt.DescriptionText = descriptionText; evt.CounterText = counterText; evt.NotificationText = notificationText; evt.IsComplete = IsCompleted; EventManager.Broadcast(evt); OnObjectiveCompleted?.Invoke(this); }
private bool CheckObjectiveProgress() { if (CurrentTask >= QuestData.objectiveDatas[CurrentObjective].TaskDatas.Length) { CurrentObjective++; CurrentTask = 0; if (!CheckQuestProgress()) { OnObjectiveCompleted?.Invoke(ID); QuestManager.Instance.Subscribe(QuestData.objectiveDatas[CurrentObjective].TaskDatas[CurrentTask], UpdateTaskProgress); } return(true); } return(false); }
public void SetupObjectiveChain(params string[] ObjectiveStageNames) { var lastStage = Nodes["ShellAccess"]; foreach (var objStageName in ObjectiveStageNames) { Nodes[objStageName] = new HackingMapNode(objStageName) { IsBlocking = true }; Nodes[objStageName].IsRightOf(lastStage); lastStage = Nodes[objStageName]; lastStage.AddAction("(Hack)", HackGesture.Typing, (action, node) => { dataEntryEffect.Play(); node.IsBlocking = false; OnObjectiveCompleted.Raise(node); }); } OnObjectiveCompleted += (o, e) => { if (e.Value.Shortname == ObjectiveStageNames.Last()) { new Effect("Shatter", Resource.Raw._349905_slowGlassShatter).Play(); Speech.Say("Objective complete."); HackingActivity.Current.Finish(); } }; var allObjectiveStages = new List <HackingMapNode>() { Nodes["ShellAccess"] }.Concat(ObjectiveStageNames.Select(name => Nodes[name])).ToArray(); Nodes["Paydata"].IsBelow(allObjectiveStages); Nodes["NetworkScan"].IsAbove(allObjectiveStages); }
/// <summary> /// Manages objective's list and provides the caller with current /// objective. If objective is expired, the next one in list is /// returned, if list is empty, then DefaultObjective is returned. /// </summary> /// /// <returns> /// Current objective, DefaultObjective if ObjectiveQueue is empty /// </returns> protected Objective GetCurrentObjective() { Objective objective; bool hasObjective; while (hasObjective = ObjectiveQueue.TryPeek(out objective)) { if (objective.Empty || objective.IsExpired || objective.Obtained) { ObjectiveQueue.TryDequeue(out objective); if (OnObjectiveCompleted != null) { OnObjectiveCompleted.Invoke(objective); } objective = null; } else { break; } } if (!hasObjective) { objective = null; } else { _commencingObjective = true; } if (objective == null) { if (_commencingObjective) { if (OnOutOfObjectives != null) { OnOutOfObjectives.Invoke(); _commencingObjective = ObjectiveQueue.TryPeek(out objective); // Check whether user just added a new task } else { _commencingObjective = false; } } if (!_commencingObjective) { return(DefaultObjective); } } else { if (!objective.Started) { objective.Start(); if (OnObjectiveStarted != null) { OnObjectiveStarted.Invoke(objective); } } } return(objective); }