/// <summary> /// Starts the dialogue between the player and an open world character by setting various references /// specific to the context. /// </summary> /// <param name="speakerPos">Speaker position.</param> /// <param name="dialogueChain">Dialogue chain.</param> /// <param name="offset">Offset.</param> /// <param name="currSpeaker">Curr speaker.</param> public void StartDialogue(Transform speakerPos, DialogueChain dialogueChain, Vector2 offset, CharacterDialogMgr currSpeaker) { //Get a reference to the current speaker this.speaker = currSpeaker; //Get reference to cuurent dialogue chain - string of text and objects for decision making currDialogueChain = dialogueChain; //Create UI elements currTextBox = CreateSpeechBubble(speakerPos, dialogueChain, offset, ref currText); }
// Use this for initialization void Start() { if (dialogMgr == null) { dialogMgr = this.GetComponent <CharacterDialogMgr>(); } if (stats == null) { Debug.Log("Stats NULL! GETTING COMPONENT"); stats = this.GetComponent <CharStatsScript>(); } if (stats.charSprite == null) { //get reference to the character's sprite stats.charSprite = this.GetComponent <SpriteRenderer>().sprite; } }
public void Copy(CharStatsData StatsToCopy) { this.Status = StatsToCopy.Status; this.HP = StatsToCopy.HP; this.MaxHP = StatsToCopy.MaxHP; this.AP = StatsToCopy.AP; this.Strength = StatsToCopy.Strength; this.Stamina = StatsToCopy.Stamina; this.WillPower = StatsToCopy.WillPower; this.Intelligence = StatsToCopy.Intelligence; this.Speed = StatsToCopy.Speed; this.CombatAbilities = StatsToCopy.CombatAbilities; this.CharName = StatsToCopy.CharName; this.ID = StatsToCopy.ID; this.DialogMgr = StatsToCopy.DialogMgr; this.charSprite = StatsToCopy.charSprite; this.FocusType = StatsToCopy.FocusType; this.BehaviorType = StatsToCopy.BehaviorType; this.AnimatorType = StatsToCopy.AnimatorType; }
public void CloseTextBox() { //Clean up objects from dialogue GameObject tBox = currTextBox; GameObject text = currText; //Reset indices for dialog positions CurrDialogueIndex = 0; newDialogueIndex = 0; //TextBoxScript tScript= currTextBox.GetComponent<TextBoxScript>(); //delete box currTextBox = null; rBox = null; currResponseScript = null; Destroy(tBox); //delete text currText = null; Destroy(text); //Reset speaker script reference; speaker = null; //Update player state PlayerController._instance.EndDialogue(); }