コード例 #1
0
 void Awake()
 {
     dialogueRoot = this.transform;
     Visible      = false;
     dialogueRoot.localPosition = hiddenLocalPosition;
     Instance = this;
 }
コード例 #2
0
    void Awake()
    {
        instance = this;

        Dialogue.dd        = this;
        DialogueManager.dd = this;

        manager = GameObject.Find("DialogueManager").GetComponent <Transform>();
        dm      = manager.GetComponent <DialogueManager> ();

        background             = manager.Find("Background").GetComponent <Image>();
        illustObject           = manager.Find("Illust");
        portrait               = manager.Find("Portrait").GetComponent <Image>();
        nameBox                = manager.Find("NameBox").GetComponent <Image>();
        nameText               = manager.Find("NameBox").Find("NameText").GetComponent <Text>();
        contentBox             = manager.Find("ContentBox").GetComponent <Image>();
        contentText            = manager.Find("ContentBox").Find("ContentText").GetComponent <Text>();
        statChangeBox          = manager.Find("StatChangeBox").gameObject;
        statChangeText         = statChangeBox.transform.Find("StatChangeText").GetComponent <Text> ();
        choiceButtonsContainer = manager.Find("ChoiceButtonsContainer");
        dialogueLogScrollView  = manager.Find("DialogueLogScrollView").gameObject;
        dialogueLogBox         = GameObject.Find("DialogueLogBox").gameObject;
        dialogueLogNameText    = dialogueLogBox.transform.Find("DialogueLogNameText").GetComponent <Text>();
        dialogueLogContentText = dialogueLogBox.transform.Find("DialogueLogContentText").GetComponent <Text> ();
        dialogueLogScrollView.SetActive(false);
        skipButtonText = manager.Find("SkipButton").transform.GetComponentInChildren <Text> ();

        transparentSprite = Resources.Load <Sprite> ("UIImages/transparent");

        SCREENSCALE = new Vector2(Screen.width / 1280f, Screen.height / 720f);

        dialogueLogs = new List <DialogueLog> ();
    }
コード例 #3
0
 private void OnDialogueStart(DialogueDisplay d)
 {
     //Debug.Log("OnDialogueStart() called");
     input.enabled = true;
     EventSystem.current.SetSelectedGameObject(null);
     EventSystem.current.SetSelectedGameObject(nextLine);
 }
コード例 #4
0
    void UpdateDisplay()
    {
        yourBox.Deactivate();
        theirBox.Deactivate();
        if (sequenceIndex >= sequence.dialogue.Length)
        {
            yourBox.Deactivate();
            theirBox.Deactivate();
            manager.EndDialogue(sequence.storySequence);
            gameObject.SetActive(false);
            return;
        }
        DialogueSequence.Dialogue  current   = sequence.dialogue[sequenceIndex];
        DialogueSequence.Character character = sequence.GetCharacter(current.characterIndex);
        DialogueDisplay            box       = character.flipSide ? theirBox : yourBox;

        box.Show(current.character, current.text, character.characterSprite);
        if (character.gameObject && current.target)
        {
            movement mv = character.gameObject.GetComponent <movement>();
            if (mv)
            {
                mv.SetTarget(current.target, false);
            }
        }
    }
コード例 #5
0
    private void CheckOffended(DialogueDisplay d)  //cheat
    {
        string whoTalk = dialogueDisplay.conversation.convoOwner;

        if (this.gameObject.name == whoTalk)
        {
            this.isOffended          = true;
            this.questHolderIndex    = 4; //cheat
            this.dialogueHolderIndex = 4;
        }
    }
コード例 #6
0
    private void LevelUp(DialogueDisplay d)
    {
        roomLevel += 1;
        //we can add more parameter changes here

        Debug.Log("Room Level = " + roomLevel);
        if (OnRoomLevelUp != null)
        {
            OnRoomLevelUp(this);
        }
    }
コード例 #7
0
    void SetCurrentQuestion(DialogueDisplay d) //change function to get specific question
    {
        Debug.Log("recieved msg from DialogueDisplay");
        int questionBlock = dialogueDisplay.blockNumber;

        currentQuestion = questions;
        questionArea.SetActive(true);

        factText.text      = currentQuestion.fact; //show the question to the UI
        correctAnswer.text = currentQuestion.correctAnswer;
        wrongAnswer.text   = currentQuestion.wrongAnswer;
    }
コード例 #8
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     activeLineIndex = 0;
 }
コード例 #9
0
    private void QuestStart(DialogueDisplay d)
    {
        //Ideal path:
        //Get the quest name from the conversation
        //Set the quest requirements
        //Announce

        isQuesting = true;
        if (OnQuesting != null)
        {
            OnQuesting(this);
        }
    }
コード例 #10
0
    public static event Action <NpcBehavior> OnTalkStart; //Announce if the NPC innitiate a talk at Talk()

    void Start()
    {
        dialogueHolderIndex = myLevel;

        sign = transform.Find("Sign").gameObject;

        dialogue        = GameObject.Find("Dialogue");
        dialogueDisplay = dialogue.GetComponent <DialogueDisplay>();
        dialogueHolder  = GetComponent <DialogueHolder>();
        input           = GetComponent <PlayerInput>();

        DialogueDisplay.OnStartConversation += DisableInput; //Observe if the dialogue ends, enable input
        DialogueDisplay.OnEndtoNothing      += EnableInput;  //Observe if the dialogue starts, disable input
        RoomState.OnRoomLevelUp             += NpcLevelup;   //Observe if the room level up
    }
コード例 #11
0
    private void CheckOffended(DialogueDisplay d)
    {
        //questReq -= 1;
        questPoint -= 1;
        if (questReq <= 0)
        {
            roomLevel += 1;
            //we can add more parameter changes here

            Debug.Log("Room Level = " + roomLevel);
            if (OnRoomLevelUp != null)
            {
                OnRoomLevelUp(this);
            }
        }
    }
コード例 #12
0
    private void CheckQuest(DialogueDisplay d) //Cheat
    {
        Debug.Log("Observed OnQuestCheck");
        string whoTalk = dialogueDisplay.conversation.convoOwner;

        Debug.Log(whoTalk);
        if (this.gameObject.name == whoTalk)
        {
            this.myQuestLevel += 1;
            Debug.Log(this.gameObject.name + " Level Up Quest");
            this.questHolderIndex += 1;
            if (OnQuestCheck != null)
            {
                OnQuestCheck(this);
            }
        }
    }
コード例 #13
0
    void Start()
    {
        gameManager = GameManager.instance;
        canvas      = transform.GetChild(0).transform;

        inventoryPanel = Instantiate(inventoryPanelPrefab, canvas);
        inventoryPanel.SetActive(false);

        dialoguePanel   = Instantiate(dialoguePanelPrefab, canvas);
        dialogueDisplay = dialoguePanel.GetComponent <DialogueDisplay>();
        dialoguePanel.SetActive(false);

        hudPanel   = Instantiate(hudPanelPrefab, canvas);
        hudDisplay = hudPanel.GetComponent <HUDDisplay>();

        storePanel = Instantiate(storePanelPrefab, canvas);
        storePanel.SetActive(false);
    }
コード例 #14
0
    void Start()
    {
        dialogueHolderIndex = myLevel;

        sign = transform.Find("Sign").gameObject;

        dialogue        = GameObject.Find("Dialogue");
        dialogueDisplay = dialogue.GetComponent <DialogueDisplay>();
        dialogueHolder  = GetComponent <DialogueHolder>();
        questHolder     = GetComponent <QuestHolder>();
        input           = GetComponent <PlayerInput>();

        DialogueDisplay.OnStartConversation += DisableInput; //Observe if the dialogue ends, enable input
        DialogueDisplay.OnEndtoNothing      += EnableInput;  //Observe if the dialogue starts, disable input
        RoomState.OnRoomLevelUp             += NpcLevelup;   //Observe if the room level up
        RoomState.OnQuesting            += QuestSetup;
        RoomState.OnQuestFail           += QuestFailState;
        RoomState.OnQuestSuccess        += QuestSuccess;
        DialogueDisplay.OnQuestCheck    += CheckQuest;
        DialogueDisplay.OnOffendedCheck += CheckOffended;
    }
コード例 #15
0
 protected override void SetReferences()
 {
     Instance = this;
     base.SetReferences();
     dialogue = GetComponentInChildren <DialogueDisplay>();
 }
コード例 #16
0
 private void DisableInput(DialogueDisplay d)
 {
     //Debug.Log(gameObject.name + " Alright DialogueManager, we disable our Player Input!");
     input.enabled = false;
 }
コード例 #17
0
 private void EnableInput(DialogueDisplay d)
 {
     //Debug.Log(gameObject.name + " read notif from dialogue manager, we can initiate talk again");
     Invoke("EnablingInput", 1); //cheat the input enable
 }
コード例 #18
0
 private void BadEnding(DialogueDisplay d)
 {
     anim.SetTrigger("ending");
     Invoke("LoadBadEnding", 1f);
 }
コード例 #19
0
 private void EnableMovement(DialogueDisplay d)
 {
     playerMode = PlayerMode.walking;
     Debug.Log(gameObject.name + "Read notif from the dialogue display, CONTROL ENABLED");
     input.enabled = true;
 }
コード例 #20
0
 void Start()
 {
     dialogueDisplay = dialogue.GetComponent <DialogueDisplay>();
     DialogueDisplay.OnEndtoQuestion += SetCurrentQuestion;
 }
コード例 #21
0
ファイル: interact.cs プロジェクト: tycelm/Work-Experience
 void Start()
 {
     DialogMsg         = GetComponent <DialogueDisplay>();
     DialogMsg.enabled = false;
 }
コード例 #22
0
 private void OnDialogueEnd(DialogueDisplay d)
 {
     //Debug.Log("OnDialogueEnd() called");
     input.enabled = false;
 }
コード例 #23
0
 private void EnableInput(DialogueDisplay d)
 {
     //Debug.Log(gameObject.name + " read notif from dialogue manager, we can initiate talk again");
     input.enabled = true;
 }