private void TryComplete(Collider2D player) { if (IsComplete) { return; } bool isActivated; isActivated = QuestActivators.Check(activator); if (player.CompareTag("Character") && isActivated) { if (!CheckRequirements()) { return; } var item = GetComponent <Item>(); if (item != null) { item.pickable = true; } IsComplete = true; // обновление состояние квеста и уведомление игрока ShowNotice(notification); if (Quest != null) { Quest.TryСomplete(); } } }
void OnTriggerStay2D(Collider2D other) { if ((other.CompareTag("Character")) && QuestActivators.Check(QuestActivator)) { // если точка уже пройдена (квест уже выполнен ранее) if (Quest.IsComplete || PlayerQuests.CompletedQuests.ContainsKey(Quest.Name)) { if (!isGenerated) { isGenerated = true; if (Quest.gold != 0) { var inventory = FindObjectOfType <Inventory>(); inventory.money += Quest.gold; FindObjectOfType <QuestNoticeManager>().ShowNotice( new QuestNotice("Получена награда:", " + " + Quest.gold + " монет")); Debug.Log(inventory.money + " награда получена"); } if (Quest.exp != 0) { var experience = FindObjectOfType <SystemPumping>(); experience.point += Quest.exp; FindObjectOfType <QuestNoticeManager>().ShowNotice( new QuestNotice("Получена награда:", " + " + Quest.exp + " очков опыта")); Debug.Log(experience.point + " награда получена"); } } return; } // если квест ещё не выполнен if (PlayerQuests.CurrentQests.ContainsKey(Quest.Name)) { if (!TryCompleteQuest()) { FindObjectOfType <QuestNoticeManager>().ShowNotice( new QuestNotice(Quest.Name, Quest.ShortDescription)); } } else { GiveQuest(other); } } }
void OnTriggerStay2D(Collider2D other) { if ((other.CompareTag("Character")) && QuestActivators.Check(QuestActivator)) { // если точка уже пройдена (квест уже выполнен ранее) if (Quest.IsComplete || PlayerQuests.CompletedQuests.ContainsKey(Quest.Name)) { return; } // если квест ещё не выполнен if (PlayerQuests.CurrentQests.ContainsKey(Quest.Name)) { if (!TryCompleteQuest()) { FindObjectOfType <QuestNoticeManager>().ShowNotice( new QuestNotice(Quest.Name, Quest.ShortDescription)); } } else { GiveQuest(other); } } }
void OnTriggerStay2D(Collider2D other) { var questManager = GetComponent <StartQuestPoint>(); if (other.CompareTag("Character") && (!isBlockedByQuest || questManager.Quest.IsComplete) && QuestActivators.Check(activator)) { SceneManager.LoadScene(nextLevel); /*objectToMove.transform.position = new Vector3(FindObjectOfType<QuestSwitchScene>().x, * FindObjectOfType<QuestSwitchScene>().y, * FindObjectOfType<QuestSwitchScene>().z);*/ } }
void OnTriggerStay2D(Collider2D other) { var questManager = GetComponent <StartQuestPoint>(); if (other.CompareTag("Character") && (!isBlockedByQuest || questManager.Quest.IsComplete) && QuestActivators.Check(activator)) { objectToMove.transform.position = new Vector2(teleportTo.position.x, teleportTo.position.y); } }