public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            // TODO: Random edge chosen currently doesn't abbide the edge conditions (always succeeds)
            var edge = edges[UnityEngine.Random.Range(0, edges.Length)];

            Finish(owner.nodes[edge.toNodeIndex]);
        }
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            var task = quest.val.GetTask(taskKey);

            switch (status)
            {
            case TaskStatus.InActive:
                task.ResetProgress();
                break;

            case TaskStatus.Active:
                task.Activate();
                break;

            case TaskStatus.Completed:
                task.Complete(true);
                break;

            case TaskStatus.Failed:
                task.Fail();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Finish(true);
        }
Exemple #3
0
        protected override void SetDialogueCamera()
        {
            _dialogueOwner = GetComponent <IDialogueOwner>();
            Assert.IsNotNull(_dialogueOwner, "No IDialogueOwner found on DialogueOwnerAutoFocus component.");
            Assert.IsNotNull(_dialogueOwner.dialogueCamera, "IDialogueOwner found, but it has no camera, can't auto focus.");

            dialogueCamera = _dialogueOwner.dialogueCamera;
        }
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            foreach (var quest in quests)
            {
                quest.val.DoAction(status);
            }

            Finish(true);
        }
Exemple #5
0
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            if (_timerHelper == null)
            {
                _timerHelper = TimerUtility.GetTimer();
            }

            _timerHelper.StartTimer(waitTime, null, OnTimerEnded);

//            Finish(true); // Finish once time is completed.
        }
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            var animator = PlayerManager.instance.currentPlayer.gameObject.GetComponent <Animator>();

            if (animator != null)
            {
                animator.Play(animation.name);
            }

            Finish(true);
        }
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            if (camera == null)
            {
                DevdogLogger.LogWarning("The player's camera is not defined. Can't set position");
                Finish(true);
                return;
            }

            camera.SetCameraPosition(position);
            Finish(true);
        }
Exemple #8
0
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
//            var factionManager = QuestSystemLoveHateBridgeManager.factionManager;
            FactionMember factionMember = null;

            switch (ownerType)
            {
            case DialogueOwnerType.Player:
            {
                var p = PlayerManager.instance.currentPlayer;
                factionMember = p.GetComponent <FactionMember>();
                break;
            }

            case DialogueOwnerType.DialogueOwner:
            {
                var qg = QuestManager.instance.currentQuestGiver;
                if (qg != null)
                {
                    factionMember = qg.transform.GetComponent <FactionMember>();
                }

                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (factionMember != null)
            {
                var deed = Deed.GetNew(deedInfo.tag, factionMember.factionID, deedInfo.targetFactionID, deedInfo.impact, deedInfo.aggression, factionMember.GetPowerLevel(), deedInfo.traits);

//                int numPersonalityTraits = factionManager.factionDatabase.personalityTraitDefinitions.Length;
//                float[] traits = Traits.Allocate(numPersonalityTraits, true); // Optional values that describe personality of deed.

                QuestSystemLoveHateBridgeManager.factionManager.CommitDeed
                (
                    factionMember,
                    deed,
                    requiresSight,
                    dimension,
                    radius
                );

                Deed.Release(deed);
            }

            Finish(true);
        }
Exemple #9
0
        /// <summary>
        /// OnExecute is called the moment the node is executed.
        /// </summary>
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            if (removeItem)
            {
                InventoryManager.RemoveItem(item.ID, amount, false);
            }
            else
            {
                item.currentStackSize = amount;
                InventoryManager.AddItem(item);
            }

            // Finish needs to be called to let execution know when the node is completed. False waits for input, true does not.
            Finish(true);
        }
        public void MoveToNextNode(ILocalIdentifier localIdentifier, IDialogueOwner owner)
        {
            var n = currentNode.GetNextNode();

            if (n != null)
            {
                MoveToNextNode(localIdentifier, n, owner);
            }
            else
            {
                if (currentNode.isLeafNode)
                {
                    // Got to end, stop.
                    Stop(localIdentifier);
                }
            }
        }
Exemple #11
0
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            if (DialogueManager.instance.currentDialogueOwner != null && DialogueManager.instance.currentDialogueOwner.transform != null)
            {
                var trigger = DialogueManager.instance.currentDialogueOwner.transform.GetComponent <VendorTrigger>();
                if (trigger != null)
                {
#if !INVENTORY_PRO_LEGACY
                    trigger.OnTriggerUsed(PlayerManager.instance.currentPlayer);
#else
                    trigger.OnTriggerUsed(InventoryPlayerManager.instance.currentPlayer);
#endif
                }
            }

            Finish(true);
        }
Exemple #12
0
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            var inventoryItems = GetRows();
            if (InventoryManager.CanAddItems(inventoryItems))
            {
                foreach (var item in inventoryItems)
                {
                    var i = UnityEngine.Object.Instantiate<InventoryItemBase>(item.item);
                    i.currentStackSize = item.amount;
                    InventoryManager.AddItem(i);
                }

                Finish(true);
                return;
            }

            Failed(QuestManager.instance.languageDatabase.inventoryIsFull); // Couldn't add items
        }
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            switch (type)
            {
            case ChangeValueType.Change:
                QuestSystemLoveHateBridgeManager.factionManager.ModifyPersonalAffinity(judgeFactionName, subjectFactionName, affinity);
                break;

            case ChangeValueType.Set:
                QuestSystemLoveHateBridgeManager.factionManager.SetPersonalAffinity(judgeFactionName, subjectFactionName, affinity);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Finish(true);
        }
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            switch (type)
            {
            case Type.Add:
                quest.val.ChangeTaskProgress(questTask, amount);
                break;

            case Type.Set:
                quest.val.SetTaskProgress(questTask, amount);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            Finish(true);
        }
        public bool StartDialogue(IDialogueOwner dialogueOwner, ILocalIdentifier localIdentifier, uint nodeStartIndex = 0)
        {
            if (CanStart(localIdentifier) == false)
            {
                return(false);
            }

            // Start dialog
            DialogueManager.instance.SetCurrentDialogue(this, dialogueOwner);
            status           = DialogueStatus.Active;
            currentNodeIndex = nodeStartIndex;

            MoveToNextNode(localIdentifier, dialogueOwner);

            DevdogLogger.LogVerbose("Started dialogue");

            return(true);
        }
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            if (DialogueManager.instance.currentDialogueOwner != null)
            {
                var fsm = DialogueManager.instance.currentDialogueOwner.transform.GetComponent <PlayMakerFSM>();
                if (fsm != null)
                {
                    fsm.SendEvent(eventName);
                }
                else
                {
                    DevdogLogger.LogWarning("No FSM found on dialogue owner. Event not invoked.");
                }
            }
            else
            {
                DevdogLogger.LogWarning("Dialogue not opened through a dialogue owner. No object is set and no FSM can therefore be found.");
            }

            Finish(true);
        }
        public override void OnExecute(IDialogueOwner dialogueOwner)
        {
            waitTime = 0; // Reset wait time incase the node is being replayed.

            if (_timerHelper == null)
            {
                _timerHelper = TimerUtility.GetTimer();
            }

            if (audioInfo.audioClip.val != null)
            {
                waitTime += audioInfo.audioClip.val.length;
            }
            else
            {
                DevdogLogger.LogError("[WaitForAudioNode] - Audio clip is missing from node: " + index + ". Dialogue: " + dialogueOwner.dialogue.name + ".");
            }

            waitTime += additionalWaitTime;

            _timerHelper.StartTimer(waitTime, null, OnTimerEnded);

            //            Finish(true); // Finish once time is completed.
        }
Exemple #18
0
        public virtual void SetCurrentDialogue(Dialogue dialogue, IDialogueOwner owner)
        {
            if (_currentDialogue != null)
            {
                _currentDialogue.OnCurrentNodeChanged -= NotifyCurrentDialogueNodeChanged;
                _currentDialogue.OnStatusChanged      -= NotifyCurrentDialogueStatusChanged;
            }

            var before = _currentDialogue;

            _currentDialogue      = dialogue;
            _currentDialogueOwner = owner;

            if (_currentDialogue != null)
            {
                _currentDialogue.OnCurrentNodeChanged += NotifyCurrentDialogueNodeChanged;
                _currentDialogue.OnStatusChanged      += NotifyCurrentDialogueStatusChanged;
            }

            if (before != _currentDialogue)
            {
                NotifyCurrentDialogueChanged(before, _currentDialogue, _currentDialogueOwner);
            }
        }
 private void OnCurrentDialogueChanged(Dialogue.Dialogue before, Dialogue.Dialogue after, IDialogueOwner owner)
 {
     FireEvent("OnCurrentDialogueChanged", after);
 }
Exemple #20
0
 /// <summary>
 /// Called before the node is executed, and before the (UI) events are fired.
 /// </summary>
 public virtual void OnEnter(IDialogueOwner dialogueOwner)
 {
 }
 private void OnCurrentDialogueStatusChanged(DialogueStatus before, DialogueStatus after, Dialogue.Dialogue self, IDialogueOwner owner)
 {
     FireEvent("OnCurrentDialogueStatusChanged", after.ToString());
 }
Exemple #22
0
 public override void OnExecute(IDialogueOwner dialogueOwner)
 {
     Finish(owner.nodes[goToNodeIndex]);
 }
Exemple #23
0
 public override void OnExecute(IDialogueOwner dialogueOwner)
 {
     variable.value = value;
     Finish(true);
 }
Exemple #24
0
        protected virtual void OnCurrentDialogueStatusChanged(DialogueStatus before, DialogueStatus after, Dialogue self, IDialogueOwner owner)
        {
            switch (after)
            {
            case DialogueStatus.InActive:
                window.Hide();
                break;

            case DialogueStatus.Active:
                window.Show();
                break;

            default:
                throw new ArgumentOutOfRangeException("after", after, null);
            }
        }
 public override void OnExecute(IDialogueOwner dialogueOwner)
 {
     // No finish, we only finish IF the player sets a decision index.
 }
        protected void MoveToNextNode(ILocalIdentifier localIdentifier, NodeBase node, IDialogueOwner owner)
        {
            currentNode.OnExit();

            node.OnEnter(owner);
            currentNodeIndex = node.index;
            node.OnExecute(owner);
        }
 public void MoveToNextNode(NodeBase node, IDialogueOwner owner)
 {
     MoveToNextNode(QuestManager.instance.localIdentifier, node, owner);
 }
Exemple #28
0
 public abstract void OnExecute(IDialogueOwner dialogueOwner);
Exemple #29
0
 public override void OnExecute(IDialogueOwner dialogueOwner)
 {
     Finish(true);
 }
 public bool StartDialogue(IDialogueOwner dialogueOwner, uint nodeStartIndex = 0)
 {
     return(StartDialogue(dialogueOwner, QuestManager.instance.localIdentifier, nodeStartIndex));
 }