public void Stop() { this.m_AudioSource.Stop(); this.m_AudioSource.clip = null; this.m_CurrentNode = null; this.SetState(Dialog.State.Finished); InputsManager.Get().UnregisterReceiver(this); HUDSelectDialogNode.Get().HideNodeSelection(); }
public void Start() { if (this.m_RootNodes.Count == 0) { Debug.Log("ERROR - dialog " + this.m_Name + " does not have root node!!!"); this.SetState(Dialog.State.Finished); return; } if (this.m_RootNodes.Count == 1) { this.PlayNode(this.m_RootNodes[0]); } else { HUDSelectDialogNode.Get().ShowNodeSelection(this.m_RootNodes, DialogsManager.Get().m_DefaultReplyTime); this.SetState(Dialog.State.WaitingForDecision); } InputsManager.Get().RegisterReceiver(this); }
public void FinishNode() { this.m_PrevNode = this.m_CurrentNode; this.m_CurrentNode = null; if (this.m_Queue.Count > 0) { this.PlayNode(this.m_Queue[0]); this.m_Queue.RemoveAt(0); return; } if (this.m_PrevNode != null) { if (this.m_PrevNode.m_Additional) { this.m_PrevNode = this.m_PrevNode.m_Prevs[0]; this.SetState(Dialog.State.WaitingForDecision); return; } int count = this.m_PrevNode.m_Nexts.Count; if (count != 0) { if (count != 1) { HUDSelectDialogNode.Get().ShowNodeSelection(this.m_PrevNode.m_Nexts, this.m_PrevNode.m_ReplyTime); this.SetState(Dialog.State.WaitingForDecision); } else if (this.m_PrevNode.m_ShowReply) { HUDSelectDialogNode.Get().ShowNodeSelection(this.m_PrevNode.m_Nexts, this.m_PrevNode.m_ReplyTime); this.SetState(Dialog.State.WaitingForDecision); } else { this.PlayNode(this.m_PrevNode.m_Nexts[0]); } } else { this.Stop(); } } }
public void Update() { if (this.m_Paused) { this.m_StartNodeTime += Time.deltaTime; this.m_StartStateTime += Time.deltaTime; this.m_AdditionalStartTime += Time.deltaTime; return; } if (this.m_AudioSource.isPlaying) { return; } if (this.m_State == Dialog.State.WaitingForDecision && this.m_PrevNode != null) { float num = (this.m_PrevNode == null) ? DialogsManager.Get().m_DefaultReplyTime : this.m_PrevNode.m_ReplyTime; if (num == 0f) { num = float.MaxValue; } if (Time.time - this.m_StartStateTime >= num) { if (this.m_PrevNode.m_FinishIfNoReply) { this.Stop(); } else { HUDSelectDialogNode.Get().OnSelect(this.m_PrevNode.m_Nexts.Count - 1); } return; } if (this.m_PrevNode.m_Additionals.Count > 0) { if (this.m_AdditionalStarted) { float nodeLength = this.GetNodeLength(this.m_CurrentAdditionalNode); if (Time.time - this.m_AdditionalStartTime >= nodeLength) { this.ResetAdditional(); } } if (!this.m_AdditionalStarted) { if (this.m_PrevNode.m_Object) { this.m_AudioSource.transform.parent = this.m_PrevNode.m_Object.transform; } else { this.m_AudioSource.transform.parent = Player.Get().transform; } this.m_AudioSource.transform.localPosition = Vector3.zero; this.m_CurrentAdditionalNode = this.m_PrevNode.m_Additionals[this.m_PrevNode.m_AdditionalIndex]; this.m_AudioSource.clip = this.m_CurrentAdditionalNode.m_Clip; this.m_AudioSource.Play(); this.m_PrevNode.m_AdditionalIndex++; if (this.m_PrevNode.m_AdditionalIndex >= this.m_PrevNode.m_Additionals.Count) { this.m_PrevNode.m_AdditionalIndex = 0; } this.m_AdditionalStarted = true; this.m_AdditionalStartTime = Time.time; } } } else if (Time.time - this.m_StartNodeTime >= this.m_CurrentNodeLength) { if (this.m_State == Dialog.State.PlayingWTSoundBefore) { this.m_AudioSource.clip = this.m_CurrentNode.m_Clip; this.m_AudioSource.Play(); this.m_StartNodeTime = Time.time; string text = GreenHellGame.Instance.GetLocalization().Get(this.m_CurrentNode.m_Name); this.m_CurrentNodeLength = ((!(this.m_AudioSource.clip != null)) ? ((this.m_CurrentNode.m_Wait <= 0f) ? Mathf.Max(2f, (float)text.Length / 20f) : this.m_CurrentNode.m_Wait) : this.m_AudioSource.clip.length); this.SetState(Dialog.State.Playing); } else if (this.m_State == Dialog.State.Playing && this.m_CurrentNode.m_WTSoundAfter) { this.m_AudioSource.clip = null; if (this.m_CurrentNode.m_WTSoundAfterName != string.Empty) { foreach (AudioClip audioClip in DialogsManager.Get().m_WTAfterSounds) { if (audioClip.name == this.m_CurrentNode.m_WTSoundAfterName) { this.m_AudioSource.clip = audioClip; break; } } } if (!this.m_AudioSource.clip) { this.m_AudioSource.clip = DialogsManager.Get().m_WTAfterSounds[UnityEngine.Random.Range(0, DialogsManager.Get().m_WTAfterSounds.Count)]; } if (!this.m_AudioSource.clip) { this.m_AudioSource.clip = DialogsManager.Get().m_WTBeforeSounds[UnityEngine.Random.Range(0, DialogsManager.Get().m_WTBeforeSounds.Count)]; } this.m_CurrentNodeLength = 1f; this.SetState(Dialog.State.PlayingWTSoundAfter); this.m_AudioSource.Play(); this.m_StartNodeTime = Time.time; } else { this.FinishNode(); } } }
protected override bool CanAttack() { return(!MainLevel.Instance.IsPause() && Time.time - MainLevel.Instance.m_LastUnpauseTime >= 0.35f && !this.m_Player.GetRotationBlocked() && !Inventory3DManager.Get().gameObject.activeSelf&& !HitReactionController.Get().IsActive() && !base.IsBlock() && !this.IsAttack() && !HUDSelectDialog.Get().enabled&& !HUDSelectDialogNode.Get().enabled&& Time.time - HUDSelectDialog.Get().m_LastSelectDialogTime >= 0.35f && Time.time - HUDSelectDialogNode.Get().m_LastSelectNodeTime >= 0.35f); }