Exemplo n.º 1
0
 private void Start()
 {
     mainCamera     = FindObjectOfType <Camera>();
     cameraAnimator = mainCamera.GetComponent <Animator>();
     cursor         = FindObjectOfType <CursorController>();
     dialogueHolder = FindObjectOfType <DialogueHolder>();
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     thePlayer = FindObjectOfType <PlayerController> ();
     fading    = GetComponent <Fading> ();
     dMan      = FindObjectOfType <DialogueManager> ();
     dHold     = GetComponent <DialogueHolder> ();
 }
 /// <summary>
 /// After colliding with an npc, use the manager with the the dialogue it holds.
 /// </summary>
 /// <param name="dHolder">The NPC's dialogue.</param>
 public void SetHolder(DialogueHolder dHolder)
 {
     if (!dialogueActive)
     {
         this.dHolder = dHolder;
     }
 }
Exemplo n.º 4
0
 void Start()
 {
     dialogueHolder = gameObject.GetComponentInChildren <DialogueHolder>();
     sr             = GetComponent <SpriteRenderer>();
     anim           = GetComponent <Animator>();
     sr.color       = new Color(1f, 1f, 1f, .5f);
 }
Exemplo n.º 5
0
    public void Awake()
    {
        string[] dialogueOptionIds = getDialogueOptionIds(4);

        DialogueHolder       dialogueHolder       = new DialogueHolder();
        DialogueOptionHolder dialogueOptionHolder = new DialogueOptionHolder();

        Dialogue rootDialogue = createDialogue("This is a test you butt!", dialogueOptionIds);
        Dialogue lastDialogue = createDialogue("I new dialogue message you say? Well it worked!", null);

        dialogueHolder.addDialogue(rootDialogue);
        dialogueHolder.addDialogue(lastDialogue);

        dialogueOptionHolder.addDialogueOption(createDialogueOption("Yes!", dialogueOptionIds[0], lastDialogue.id));
        dialogueOptionHolder.addDialogueOption(createDialogueOption("No!", dialogueOptionIds[1], lastDialogue.id));
        dialogueOptionHolder.addDialogueOption(createDialogueOption("Uh, f**k you!", dialogueOptionIds[2], lastDialogue.id));
        dialogueOptionHolder.addDialogueOption(createDialogueOption("...", dialogueOptionIds[3], lastDialogue.id));

        FileUtils.writeFile(fileName + ".DialogueHolder.json", dialogueHolder.toJsonString());
        FileUtils.writeFile(fileName + ".DialogueOptionHolder.json", dialogueOptionHolder.toJsonString());


        dialogueController.setDialogueHolder(dialogueHolder);
        dialogueController.setDialogueOptionHolder(dialogueOptionHolder);
        dialogueController.setDialogue(rootDialogue.id);
        dialogueController.enableUI(true);
    }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        dPopUp = FindObjectOfType <DialogueHolder>();



        thePlayer = FindObjectOfType <PlayerMovement>();
    }
Exemplo n.º 7
0
 // Use this for initialization
 void Awake()
 {
     Instance = this;
     dialogue = new Dictionary<string, string>();
     maleCharacter = new List<string>();
     femaleCharacter = new List<string>();
     characterNameDictionary = new Dictionary<string, string>();
 }
Exemplo n.º 8
0
    /// <summary>
    /// MoveToNextDialogue
    /// Moves to the next dialogue, but does not display it.
    /// </summary>
    public void MoveToNextDialogue()
    {
        if (currentDialogue == null || currentDialogue.NextDialogue == null)
        {
            return;
        }

        currentDialogue = currentDialogue.NextDialogue;
    }
    void finishDialogue()
    {
        dialogueTextObject.SetActive(false);
        dialogueCharaObject.SetActive(false);

        _currentHolder     = null;
        _currentCharaIndex = 0;
        onDialogueClosed();
    }
Exemplo n.º 10
0
	private static void ResetDialogue() {
		GameObject NPC = GameObject.Find ("NPCs");
		foreach (Transform child in NPC.transform) {
			DialogueHolder dHolder = child.GetComponent<DialogueHolder> ();
			if (dHolder != null && !dHolder.enabled) {
				Debug.Log ("inside dHolder");
				dHolder.enabled = true;
			}
		}
	}
Exemplo n.º 11
0
    public static DialogueHolder createFromJsonString(string json)
    {
        SerializableArrayWrapper <Dialogue> wrapper = JsonUtility.FromJson <SerializableArrayWrapper <Dialogue> >(json);
        DialogueHolder dialogueHolder = new DialogueHolder();

        foreach (Dialogue dialogue in wrapper.items)
        {
            dialogueHolder.addDialogue(dialogue);
        }

        return(dialogueHolder);
    }
Exemplo n.º 12
0
    void Start()
    {
        dialogueManager = FindObjectOfType <DialogueManager>();
        dialogueHolder  = FindObjectOfType <DialogueHolder>();
        fishing         = FindObjectOfType <Fishing>();

        //set NPC dialogue to non tutorial dialogue
        dialogueObj[1].GetComponent <DialogueHolder>().option4 = true;
        dialogueObj[3].GetComponent <DialogueHolder>().option3 = true;

        loaded = true;
    }
    // Use this for initialization
    void Awake()
    {
        pos      = transform.position;
        sprite   = GetComponent <SpriteRenderer>();
        anim     = GetComponent <Animator>();
        dMAn     = FindObjectOfType <DialogueManager>();
        dialogue = GetComponent <DialogueHolder>();

        waitCounter = waitTime;
        player      = GameObject.Find("Player");
        ChooseDirection();
    }
    void showDialogue(DialogueHolder holder)
    {
        dialogueTextObject.SetActive(true);
        dialogueCharaObject.SetActive(true);

        _currentHolder     = holder;
        _currentCharaIndex = 0;

        //drawDialogueText(model.dialogues)
        showCharaDialogues();

        onDialogueOpened();
    }
Exemplo n.º 15
0
    /// <summary>
    /// StartCutSceneCoroutine
    /// Start the coroutine that take care of the cutscene.
    /// </summary>
    private IEnumerator StartCutSceneCoroutine()
    {
        currentDialogue = _cutSceneFirstDialogue;

        while (currentDialogue != null)
        {
            _lastDialogueTimestamp     = Time.time;
            _startingCutSceneText.text = currentDialogue.Dialogue;
            currentDialogue            = currentDialogue.NextDialogue;
            yield return(new WaitUntil(() => Time.time - _lastDialogueTimestamp > _cutsceneDialogueDuration));
        }

        EndCutScene();
    }
Exemplo n.º 16
0
 /// <summary>
 /// EndCutScene
 /// Ends the cutscene at the start of the game.
 /// </summary>
 private void EndCutScene()
 {
     if (!_cutscenePlayed)
     {
         if (_cutSceneCoroutine != null)
         {
             StopCoroutine(_cutSceneCoroutine);
             _cutSceneCoroutine = null;
         }
         currentDialogue = _firstDialogueGameplay;
         _cutscenePlayed = true;
         CutSceneEnding.Invoke();
     }
 }
    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
    }
Exemplo n.º 18
0
    private bool canCheckNewValues; // After a brief timer upon loading into a new scene, this value gets refreshed; this gives objects time to load.


    void Start()
    {
        //Get ready to assign some shit
        mainCam        = GameObject.FindGameObjectWithTag("MainCamera");
        playerHolder   = GameObject.FindGameObjectWithTag("Player");
        gameController = GameObject.FindGameObjectWithTag("GameController");
        battTran       = gameController.GetComponent <BattleTransitions>();

        /*for (int i = 0; i < scripts.Count; i++)
         * {
         *  dataPaths.Add( Path.Combine(Application.persistentDataPath, "porygon_" + scripts[i].name + ".txt") );
         * }*/
        dataPath = Path.Combine(Application.persistentDataPath, "porygon.txt");

        narrMan = mainCam.GetComponent <NarrativeManager>();
        diaHold = mainCam.GetComponent <DialogueHolder>();

        player     = playerHolder.transform.GetChild(0).gameObject;
        playerAnim = player.GetComponent <Animator>();

        blackScreen = GameObject.FindGameObjectWithTag("BlackScreen").GetComponent <Image>();

        //Debug.Log(saveIcon);

        if (saveIcon == null)
        {
            saveIcon         = GameObject.FindGameObjectsWithTag("SaveIcon")[0].GetComponent <Image>();
            saveIcon.enabled = false;
        }
        if (saveIconText == null)
        {
            saveIconText         = GameObject.FindGameObjectsWithTag("SaveIcon")[1].GetComponent <Image>();
            saveIconText.enabled = false;
        }

        // Quickly make sure that our louNotesSeen list has the same length as our manually set list.
        if (louNotesSeen.Count != louNotes.Count)
        {
            for (int i = louNotesSeen.Count; i < louNotes.Count; i++)
            {
                louNotesSeen.Add(false);
            }
        }

        StartCoroutine(SaveSpin());
    }
Exemplo n.º 19
0
    /// <summary>
    /// Trie les dialogue holder obtenus grâce à la fonction dans le start
    /// permet d'aligner les quetes (leurs index) et les pnj (leurs index)
    /// </summary>
    public void setIndex()
    {
        DialogueHolder dhold2;
        DialogueHolder temp = dhold[0];

        for (int i = 0; i < dhold.Length; i++)
        {
            for (int j = 0; j < dhold.Length; j++)
            {
                if (quetes[i].indexQuete == dhold[j].QuestIndex)
                {
                    temp = dhold[i];
                    dhold[quetes[i].indexQuete] = dhold[j];
                    dhold[j] = temp;
                }
            }
        }
    }
    public void SetStartDialogue(DialogueHolder currentDialogue)
    {
        StopAllCoroutines();
        _isEnd          = false;
        _dialogueHolder = currentDialogue;
        _dialogueIndex  = 0;
        _lineIndex      = -1;

        //Faz a caixa de diálogo aparecer
        _dialogueBoxAnimator.gameObject.SetActive(true);

        //Define a aparência do personagem
        SetSpeakerAppearance();

        //Chama o método de imprimir o texto depois de meio segundo de delay, para dar tempo da animação tocar
        _lineText.text = "";
        ShowLine(1);
    }
Exemplo n.º 21
0
    }//end of start

    void Update()
    {
        narrObject = FindObject();
        if (narrObject != null)
        {
            currDia = narrObject.GetComponent <DialogueHolder>();
            //ManageLevelEmail();
            if (currDia.getDialogueDone() && GameManager.getDeathCount() == 1 && healthEmail != null)
            {
                ChangeOpacity(healthEmail, 1.0f);
                if (healthEmail.transform.childCount >= 1)
                {
                    healthEmail.transform.GetChild(0).gameObject.GetComponent <Text>().enabled = true;
                }
            } //end of outer if
        }     //end of if narrObject
        if (narrObject != null && manageLvl)
        {
            manageLvl = setDifficulty(manageLvl);
        }
    }//end of update
Exemplo n.º 22
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;
    }
Exemplo n.º 23
0
    /// <summary>
    /// dans l'update, la classe Target vérifie si son box collider est en contact avec le joueur pour le récompenser
    /// et pour s'assurer de n'avoir complété la quête qu'une seule fois. Elle va rendre le pnj inutile inactif
    /// sans toutefois affecter son dialogue holder qui est nécessaire au bon fonctionnement du programme.
    /// </summary>
    private void Update()
    {
        if (timer)
        {
            timer = false;
        }


        if (bc2.IsTouching(questGiver.player.GetComponent <Collider2D>()) && !cond)
        {
            DialogueHolder dhold = pnjDebut.GetComponentInChildren <DialogueHolder>();
            if (questGiver.quetes[dhold.QuestIndex].isActive)
            {
                quete = questGiver.quetes[dhold.QuestIndex];
                questGiver.quetes[quete.indexQuete].questEnded = true;

                cond = true;
                pnjDebut.GetComponentInChildren <SpriteRenderer>().gameObject.SetActive(false);

                dhold.canTalk = false;
                questGiver.OpenQuestWindow(dhold.QuestIndex);
            }
        }
    }
Exemplo n.º 24
0
 private void Awake()
 {
     anim     = GetComponentInChildren <Animator>();
     dialogue = GetComponent <DialogueHolder>();
 }
Exemplo n.º 25
0
 // Start is called before the first frame update
 void Start()
 {
     dhold = GetComponentInChildren <DialogueHolder>();
 }
Exemplo n.º 26
0
 void Awake()
 {
     dialogue = GetComponent <DialogueHolder>();
 }
 public void GetHolder(DialogueHolder DHolder)
 {
     this.DHol = DHolder;
 }
Exemplo n.º 28
0
 private void Awake()
 {
     instance = this;
 }
 // Use this for initialization
 void Start()
 {
     dHolder = FindObjectOfType <DialogueHolder>();
     puerta.GetComponent <SpriteRenderer>().color = new Color32(0, 0, 0, 0);
 }
Exemplo n.º 30
0
 void Start()
 {
     dialogue = GetComponent <DialogueHolder>();
     dialogue.StartDialogue();
 }
Exemplo n.º 31
0
 // Use this for initialization
 void Start()
 {
     holder = FindObjectOfType <DialogueHolder>();
 }