void OnGUI()
    {
        GUI.depth = -10;

        if (GUI.Button(new Rect(25, 25, 125, 30), "Unity GUI"))
        {
            Dialoguer.events.ClearAll();
            unityDialogue.addDialoguerEvents();
            Dialoguer.StartDialogue(0);                 // Generic
        }

        if (GUI.Button(new Rect(25, 25 + 30 + 10, 125, 30), "Old School RPG"))
        {
            Dialoguer.events.ClearAll();
            oldRpgDialogue.addDialoguerEvents();
            Dialoguer.StartDialogue(DialoguerDialogues.OldSchoolRPG);                   // Old SchoolRPG
        }

        if (GUI.Button(new Rect(25, 25 + 60 + 20, 125, 30), "NextGen RPG"))
        {
            Dialoguer.events.ClearAll();
            nextGenRpgDialogue.addDialoguerEvents();
            Dialoguer.StartDialogue(2);                 // Old SchoolRPG
        }
    }
Esempio n. 2
0
    public void Speak(int npcID, int index)
    {
        if (_showing)
        {
            return;
        }

        JSONNode npcDialogue = RetrieveDialogueFromJSON();

        if (npcDialogue [npcID.ToString()] == null)
        {
            Debug.Log("NPC ID: " + npcID + " doesn't exist, check dialogue list json file!");
            return;
        }

        if (npcDialogue [npcID.ToString()] [index] == null)
        {
            Debug.Log("Index: " + index + " on NPC ID: " + npcID + " doesn't exist, check dialogue list json file!");
            return;
        }

        Dialoguer.StartDialogue(npcDialogue [npcID.ToString()] [index].AsInt);

        return;
    }
Esempio n. 3
0
    void Update()
    {
        if (player == null)
        {
            player = (playerScript)FindObjectOfType(typeof(playerScript));
        }

        if (clickedOnSomething)
        {
            onMouseMiss();
        }

        if (clickedOnSomething)
        {
            if (pDist.isCloseEnough(player.transform.position))
            {
                pickUpItem();
            }
        }

        if (autoPickupPostConvo && GameManager.dialogueJustFinished && checkCondis() && !clickedOnSomething)
        {
            if (pDist.isCloseEnough(player.transform.position) && !player.talking && tookItem)
            {
                handleAssociated();
                collectItems();
                player.stopMove();
                player.talking = true;
                Dialoguer.StartDialogue(pickUpConvo);
                autoPickupPostConvo = false;
            }
        }
    }
Esempio n. 4
0
    void Update()
    {
        Debug.LogWarning("Just Finished: " + GameManager.dialogueJustFinished);
        if (GameManager.dialogueJustFinished)
        {
            started = true;
            GameManager.dialogueJustFinished = false;
        }
        if (started)
        {
            if (progress <= 0f)
            {
                failure = true;
            }
            else if (progress < progressNeeded && !success)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    progress++;
                }

                progress -= Time.deltaTime * 2;
            }
            else if (progress >= progressNeeded && !success)
            {
                success = true;
            }
        }

        if (success && !playingConv)
        {
            if (waitThisLong <= 0)
            {
                playingConv = true;
                Debug.LogWarning("YAY");
                if (nextScene != "")
                {
                    Application.LoadLevel(nextScene);
                }
            }
            else
            {
                waitThisLong -= Time.deltaTime;
            }
        }
        else if (failure && !playingConv)
        {
            playingConv = true;
            Debug.LogWarning("AWW");
            if (failConversation != Convo.ch0none)
            {
                Dialoguer.StartDialogue((int)failConversation);
            }
        }
        else if (playingConv && GameManager.dialogueJustFinished)
        {
            Application.LoadLevel(Application.loadedLevelName);
        }
    }
Esempio n. 5
0
 void OnMouseDown()
 {
     if (((int)dontGotIt) != -1 && !gotThem())
     {
         GameManager.dialogueJustFinished = false;
         Dialoguer.StartDialogue((int)dontGotIt);
     }
 }
Esempio n. 6
0
 public void talk(Talk talk)
 {
     AuM.playAudio("talk");
     Dialoguer.StartDialogue(0);
     UM.state = "dialog";
     if (talk.destroyOnFinish)
     {
     }
 }
Esempio n. 7
0
 public void startDialogue()
 {
     if (!wall)
     {
         GameManager.dialogueJustFinished = false;
         StartCoroutine("DialogueDone");
         Dialoguer.StartDialogue((int)dialogueEnum);
     }
 }
Esempio n. 8
0
 void OnGUI()
 {
     wait -= Time.deltaTime;
     if (wait < 0 && !init)
     {
         init = true;
         Dialoguer.StartDialogue(4);
     }
 }
    public void OpenStuff(InteractableObject iO, GameObject gObj)
    {
        //open stuff
        PlaySound(GameController.instance.gameSettings.clickSound4);

        DialoguerDialogues diag = DialoguerDialogues.None;

        try{
            diag = (DialoguerDialogues)System.Enum.Parse(typeof(DialoguerDialogues), gObj.name + "_Open_True");
        }
        catch
        {
            Debug.Log("Dialogue needs to be set!");
        }

        if (diag != DialoguerDialogues.None)
        {
            Dialoguer.StartDialogue(diag);
            GameController.instance.dCon.obsTextObj.SetActive(true);
        }
        CloseInteractiveMenu();
        //
        if (iO.spriteToActivate != null)
        {
            iO.spriteToActivate.gameObject.SetActive(true);
        }
        if (iO.spriteRendererToUpdate != null)
        {
            SpriteRenderer r = iO.spriteRendererToUpdate;
            if (r.sprite == iO.spriteToUpdateFrom)
            {
                r.sprite = iO.spriteToUpdateTo;
            }
            else
            {
                r.sprite = iO.spriteToUpdateFrom;
            }
        }
        if (iO.objsToEnable.Length > 0)
        {
            for (int i = 0; i < iO.objsToEnable.Length; i++)
            {
                iO.objsToEnable[i].SetActive(true);
            }
        }
        if (gObj.GetComponent <InteractableObject>().disableOnOpen)
        {
            gObj.SetActive(false);
        }

        if (iO.clipPlay != null)
        {
            GameController.instance.audioClipSource.GetComponent <AudioSource>().clip = iO.clipPlay;
            GameController.instance.audioClipSource.GetComponent <AudioSource>().Play();
        }
    }
Esempio n. 10
0
        public override bool Trigger(Game game)
        {
            Dialoguer.events.onEnded        += OnDialoguerEnd;
            Dialoguer.events.onMessageEvent += OnDialoguerEvent;
            Dialoguer.events.onCondition    += OnDialoguerCondition;

            ResveredGame = game;
            Dialoguer.StartDialogue(Dialog);

            return(!StayAfterTalk);
        }
Esempio n. 11
0
 public void revealItem()
 {
     player.talking = true;
     player.stopMove();
     SoundManager.Instance.StopWalk();
     Dialoguer.StartDialogue((int)convoID);
     clickedOnSomething = false;
     Instantiate(iHoldThis, new Vector3(transform.localPosition.x, transform.localPosition.y, -1), Quaternion.identity);
     //journal.SendMessage("addObject", iHoldThis);
     Destroy(this.gameObject);
     GameManager.Instance.updateMouseIcon(mouseOverIcon);
 }
    public void StartDialog(DialoguerDialogues dialog)
    {
        if (GetPlayerMove())
        {
            Dialoguer.events.ClearAll();
            addDialoguerEvents();
            Dialoguer.StartDialogue(dialog);

            // Disable player
            SetPlayerMove(false);
        }
    }
Esempio n. 13
0
    void playDialogue()
    {
        if (dialogue.Length != 0)
        {
            Dialoguer.StartDialogue((int)dialogue[curDia]);

            if (player != null)
            {
                player.stopMove();
                player.talking = true;
            }
        }
    }
Esempio n. 14
0
 public void startDialogue()
 {
     if (!wall)
     {
         Dialoguer.StartDialogue((int)diaNum + offset);
     }
     player.stopMove();
     SoundManager.Instance.StopWalk();
     GameManager.Instance.updateMouseIcon(mouseOverIcon);
     clickedOnSomething = false;
     player.talking     = true;
     doneTalking        = true;
 }
Esempio n. 15
0
    void Update()
    {
        float distCovered = (Time.time - startTime) * speed;
        float fracJourney = distCovered / distance;

        transform.position = Vector3.Lerp(startPosition, destination, fracJourney);
        if (transform.position.x == destination.x)
        {
            if (!atPosition)
            {
                Dialoguer.StartDialogue(dialogNumber);
                print("Showing disable");
                atPosition = true;
            }
        }
    }
Esempio n. 16
0
    IEnumerator wait()
    {
        if (!startEnd)
        {
            if (gotThem())
            {
                GameManager.dialogueJustFinished = false;
                Dialoguer.StartDialogue((int)dialogue [curDia]);
                playerScript player = FindObjectOfType(typeof(playerScript)) as playerScript;
                player.stopMove();
                startEnd = !startEnd;


                SoundManager.Instance.Play2DMusic(playMe);
                //Debug.Log (debugMe);
            }
        }
        else
        {
            if (GameManager.dialogueJustFinished && curDia < dialogue.Length - 1)
            {
                GameManager.dialogueJustFinished = false;
                curDia++;
                Dialoguer.StartDialogue((int)dialogue [curDia]);
            }
            else if ((int)dialogue [curDia] >= 0 && GameManager.dialogueJustFinished && curDia == dialogue.Length - 1)
            {
                if (player != null)
                {
                    player.canWalk = false;
                }
                yield return(new WaitForSeconds(waitThisLong));

                GameManager.Instance.playerInScene = isTherePlayer;
                done = true;
                if (isTherePlayer)
                {
                    GameManager.Instance.SetMainCharacter(whatCharacter);
                    GameManager.Instance.SetNextX(spawnHereAfter.x);
                    GameManager.Instance.SetNextX(spawnHereAfter.y);
                }
                GameManager.dialogueJustFinished = false;
                Application.LoadLevel(nextLevel);
            }
        }
    }
Esempio n. 17
0
    public void startDialogue()
    {
        var temp = gameObject.GetComponent <victoryCondition> ();

        if (temp != null)
        {
            //temp.curDia -= 1;

            Debug.Log(Dialoguer.GetGlobalBoolean(1));
        }
        Dialoguer.StartDialogue((int)myConvo);
        player.stopMove();
        GameManager.Instance.updateMouseIcon(mouseOverIcon);
        clickedOnSomething = false;
        player.talking     = true;

        DialogueGUI_Test dGUI = GameManager.Instance.GetComponent <DialogueGUI_Test>();

        //Debug.Log ("LEFT SPRITE: " + this.elementName);
        dGUI.setLeftSpriteName((this.elementName + "Sprite").Replace(" ", string.Empty));
    }
Esempio n. 18
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 100, 30), "Start!"))
        {
            // The preferred way to start dialogues is with the DialoguerDialogues enum
            // Like so:
            // Dialoguer.StartDialogue(DialoguerDialogues.My_First_Dialogue_Tree);

            // Or you can start it by passing the ID of the dialogue you want to start
            // Like so:
            // Dialoguer.StartDialogue(0);

            // We'll use the ID method for now, in order to avoid any errors when you start creating your own dialogues.
            Dialoguer.StartDialogue(0);

            // By default, the DialoguerDialogues enum is automatically updated when you save your dialogues.
            // You can turn this off in the Dialoguer preferences menu.
        }

        string message = "Open this file (DialoguerExampleStart.cs) to see how to start using Dialoguer";

        GUI.Label(new Rect(10, 50, 500, 500), message);
    }
Esempio n. 19
0
    public void pickUpItem()
    {
        player.stopMove();
        clickedOnSomething = false;

        //Debug.LogError ("Inventory: " + journal.inventory[0]);
        GameManager.Instance.updateMouseIcon(mouseOverIcon);

        if (checkCondis())
        {
            handleAssociated();
            collectItems();
            //player.stopMove ();
            player.talking = true;
            Dialoguer.StartDialogue((int)myConvo);
        }
        else if (myConvo != Convo.ch0none)
        {
            player.talking = true;
            //player.stopMove ();
            Dialoguer.StartDialogue((int)myConvo);
            tookItem = true;
        }
    }
Esempio n. 20
0
 public void Execute(int x, int y, TileData otherTileData)
 {
     AudioManager.Instance.playAudio("talk");
     //otherTileData.gameObject.GetComponent<Talk>();
     Dialoguer.StartDialogue(dialogureID);
 }
Esempio n. 21
0
 void handleAnnouncement(int number)
 {
     Dialoguer.StartDialogue(number);
 }
    public void Clicked(Image img, GameObject gObj)
    {
//		Debug.Log (gObj + "lala");
//		Debug.Log ("GEGNI1");


        InteractableObject iO = gObj.GetComponent <InteractableObject>();

        if (img == observeIconActive)
        {
//
            PlaySound(GameController.instance.gameSettings.clickSound1);

            if (iO.observeVO != null)
            {
                PlayVO(iO.observeVO);
            }

            CCircle(img);
//			if(DialoguerDialogues
//			if(

            DialoguerDialogues diag = DialoguerDialogues.None;
            try{
                diag = (DialoguerDialogues)System.Enum.Parse(typeof(DialoguerDialogues), gObj.name + "_Observe");
            }
            catch
            {
                Debug.Log("Dialogue needs to be set!");
            }

            if (diag != DialoguerDialogues.None)
            {
                Dialoguer.StartDialogue(diag);
                GameController.instance.dCon.obsTextObj.SetActive(true);
                Debug.Log("NUEG");
            }
//			}
        }
        if (img == pickupIconActive)
        {
            PlaySound(GameController.instance.gameSettings.clickSound2);
            if (iO.pickupVO != null)
            {
                PlayVO(iO.pickupVO);
            }

            CCircle(img);
            if (gObj.GetComponent <InteractableObject>().inventoryObject != null)
            {
//				Debug.Log(gObj.GetComponent<InteractableObject>().investigateObj);

//				GameController.instance.inventoryController.addObj = gObj.GetComponent<InteractableObject>().investigateObj;
                GameController.instance.inventoryController.AddToInventory(gObj.GetComponent <InteractableObject>().inventoryObject, gObj.GetComponent <InteractableObject>().smallObj);
            }

//			if(System.Enum.IsDefined(typeof(DialoguerDialogues), (DialoguerDialogues) System.Enum.Parse( typeof( DialoguerDialogues ), gObj.name + "_Pickup" )))
//			{
//
//			}
//			Debug.Log ();

            DialoguerDialogues diag = DialoguerDialogues.None;
            try{
                diag = (DialoguerDialogues)System.Enum.Parse(typeof(DialoguerDialogues), gObj.name + "_Pickup");
            }
            catch
            {
                Debug.Log("Dialogue needs to be set!");
            }

            if (diag != DialoguerDialogues.None)
            {
                Dialoguer.StartDialogue(diag);
                GameController.instance.dCon.obsTextObj.SetActive(true);
            }


            if (gObj.GetComponent <InteractableObject>().disableOnPickup)
            {
                gObj.SetActive(false);
            }

//			Debug.Log("GBNEU");
            gObj.SetActive(false);
            CloseInteractiveMenu();
            open = true;
        }
        if (img == talkIconActive)
        {
//			DialoguerDialogues diag = (DialoguerDialogues) System.Enum.Parse( typeof( DialoguerDialogues ), gObj.name + "_Talk" );
        }
        if (img == zoomIconActive)
        {
            PlaySound(GameController.instance.gameSettings.clickSound1);
            if (iO.zoomVO != null)
            {
                PlayVO(iO.zoomVO);
            }

            if (gObj.GetComponent <InteractableObject>().investigateObj != null)
            {
                GameController.instance.playerState = GameController.PlayerState.Zoom;
                CloseInteractiveMenu();
                gObj.GetComponent <InteractableObject>().investigateObj.SetActive(true);

                if (GameController.instance.gameSettings.zoomIcon != null)
                {
                    if (backButton == null)
                    {
                        backButton = Instantiate(GameController.instance.gameSettings.zoomBackButton, Vector3.zero, Quaternion.identity) as GameObject;
                        backButton.transform.SetParent(GameController.instance.uiCanvas.transform);
                        backButton.GetComponent <Button>().onClick.AddListener(() => PlayClip());
                        RectTransform rT = backButton.GetComponent <RectTransform>();

                        rT.anchoredPosition = GameController.instance.gameSettings.zoomBackButton.GetComponent <RectTransform>().anchoredPosition;
                        rT.localScale       = GameController.instance.gameSettings.zoomBackButton.GetComponent <RectTransform>().localScale;
                        rT.sizeDelta        = GameController.instance.gameSettings.zoomBackButton.GetComponent <RectTransform>().sizeDelta;
                    }
                    else
                    {
                        backButton.SetActive(true);
                    }

                    backButton.GetComponent <Button>().onClick.AddListener(() => GoBackFromZoom(gObj.GetComponent <InteractableObject>()));
                }
            }
//			DialoguerDialogues diag = (DialoguerDialogues) System.Enum.Parse( typeof( DialoguerDialogues ), gObj.name + "_Investigate" );
        }
        if (img == useIconActive)
        {
            if (iO.useVO != null)
            {
                PlayVO(iO.useVO);
            }

            PlaySound(GameController.instance.gameSettings.clickSound1);
            DialoguerDialogues diag = DialoguerDialogues.None;
            try{
                diag = (DialoguerDialogues)System.Enum.Parse(typeof(DialoguerDialogues), gObj.name + "_Use");
            }
            catch
            {
                Debug.Log("Dialogue needs to be set!");
            }

            if (diag != DialoguerDialogues.None)
            {
                Dialoguer.StartDialogue(diag);
                GameController.instance.dCon.obsTextObj.SetActive(true);
            }
        }
        if (img == openIconActive)
        {
            PlaySound(GameController.instance.gameSettings.clickSound1);


            CloseInteractiveMenu();
            CCircle(img);
            if (iO.clickInventoryItemNeeded == null)
            {
//				Debug.Log ("BGNEU");
                OpenStuff(iO, gObj);

//				if(iO.spriteToActivate != null)
//				{
//					iO.spriteToActivate.gameObject.SetActive(true);
//				}
//				if(iO.spriteRendererToUpdate != null)
//				{
//					SpriteRenderer r = iO.spriteRendererToUpdate;
//					if(r.sprite == iO.spriteToUpdateFrom)
//						r.sprite = iO.spriteToUpdateTo;
//					else
//						r.sprite = iO.spriteToUpdateFrom;
//				}
//				if(iO.objsToEnable.Length > 0)
//				{
//					for(int i = 0; i < iO.objsToEnable.Length; i++)
//				    {
//						iO.objsToEnable[i].SetActive(true);
//					}
//
//				}
//				if(gObj.GetComponent<InteractableObject>().disableOnOpen)
//				{
//					gObj.SetActive(false);
//				}
//
//				if(iO.clipPlay != null)
//				{
//					GameController.instance.audioClipSource.GetComponent<AudioSource>().clip = iO.clipPlay;
//					GameController.instance.audioClipSource.GetComponent<AudioSource>().Play();
//				}
            }
            else
            {
                if (iO.openVO != null)
                {
                    PlayVO(iO.openVO);
                }

                DialoguerDialogues diag = DialoguerDialogues.None;
                try{
                    diag = (DialoguerDialogues)System.Enum.Parse(typeof(DialoguerDialogues), gObj.name + "_Open");
                }
                catch
                {
                    Debug.Log("Dialogue needs to be set!");
                }

                if (diag != DialoguerDialogues.None)
                {
                    Dialoguer.StartDialogue(diag);
                    GameController.instance.dCon.obsTextObj.SetActive(true);
                }
            }
        }
        if (img == leaveIconActive)
        {
            PlaySound(GameController.instance.gameSettings.clickSound1);

            CCircle(img);
            int itemsNeeded = 0;
            if (gObj.GetComponent <InteractableObject>().neededInventoryObjs.Length > 0)
            {
                foreach (GameObject g in gObj.GetComponent <InteractableObject>().neededInventoryObjs)
                {
                    if (GameController.instance.inventoryController.inventoryObjects.Contains(g.ToString()))
                    {
                        itemsNeeded++;
                    }
                }
                if (gObj.GetComponent <InteractableObject>().neededInventoryObjs.Length == itemsNeeded)
                {
                    DialoguerDialogues diag = (DialoguerDialogues)System.Enum.Parse(typeof(DialoguerDialogues), gObj.name + "_Leave_True");
                    Dialoguer.StartDialogue(diag);
                    GameController.instance.dCon.obsTextObj.SetActive(true);
                    StartCoroutine(End());
                }

                else
                {
                    DialoguerDialogues diag = (DialoguerDialogues)System.Enum.Parse(typeof(DialoguerDialogues), gObj.name + "_Leave_False");
                    Dialoguer.StartDialogue(diag);
                    GameController.instance.dCon.obsTextObj.SetActive(true);
//					StartCoroutine(End ());
                }
            }
        }
    }
Esempio n. 23
0
 public void beginDialogue()
 {
     global.GetComponent <GlobalVars>().processing += 1;
     Dialoguer.StartDialogue(which);
 }
Esempio n. 24
0
 public void DialogueStart()
 {
     Dialoguer.StartDialogue(3, dialoguerCallback);
     this.enabled = false;
 }
Esempio n. 25
0
 public void PlayDialogue(DialoguerDialogues dialogue)
 {
     Dialoguer.StartDialogue(dialogue);
 }
Esempio n. 26
0
    IEnumerator wait()
    {
        SoundManager.Instance.Play2DMusic(playMe);
        if (dialogue.Length != 0)
        {
            if (!GameManager.dialogueJustFinished)
            {
                player = (playerScript)FindObjectOfType(typeof(playerScript));
                if (player != null)
                {
                    player.stopMove();
                    player.talking = true;
                    //Debug.LogWarning("TALKING");
                }
            }

            if (GameManager.dialogueJustFinished && curDia < dialogue.Length - 1)
            {
                GameManager.dialogueJustFinished = false;
                curDia++;
                Dialoguer.StartDialogue((int)dialogue [curDia]);
            }
            else
            if ((int)dialogue [curDia] >= 0 && GameManager.dialogueJustFinished && curDia == dialogue.Length - 1)
            {
                if (waitThisLong != -1)
                {
                    if (player != null)
                    {
                        player.canWalk = false;
                    }
                    yield return(new WaitForSeconds(waitThisLong));

                    done = true;
                    GameManager.Instance.playerInScene = isTherePlayer;

                    if (isTherePlayer)
                    {
                        //Debug.Log ("Setting nexts to " + spawnHereAfter.x + " and " + spawnHereAfter.y);
                        GameManager.Instance.SetMainCharacter(whatCharacter);
                        GameManager.Instance.SetNextX(spawnHereAfter.x);
                        GameManager.Instance.SetNextY(spawnHereAfter.y);
                    }
                    GameManager.dialogueJustFinished = false;
                    SoundManager.Instance.CantWalk();
                    Application.LoadLevel(nextLevel);
                }
            }
            else if (dialogue [curDia].Equals(Convo.ch0none))
            {
                if (waitThisLong != -1)
                {
                    yield return(new WaitForSeconds(waitThisLong));

                    GameManager.Instance.playerInScene = isTherePlayer;
                    done = true;
                    if (isTherePlayer)
                    {
                        if (!GameManager.Instance.playerInScene)
                        {
                            GameManager.Instance.playerInScene = true;
                        }
                        Debug.Log("Setting nexts to " + spawnHereAfter.x + " and " + spawnHereAfter.y);
                        GameManager.Instance.SetMainCharacter(whatCharacter);
                        GameManager.Instance.SetNextX(spawnHereAfter.x);
                        GameManager.Instance.SetNextY(spawnHereAfter.y);
                    }
                    GameManager.dialogueJustFinished = false;
                    SoundManager.Instance.CantWalk();
                    Application.LoadLevel(nextLevel);
                }
            }
        }
        else if (waitThisLong != -1)
        {
            yield return(new WaitForSeconds(waitThisLong));

            done = true;
            GameManager.Instance.playerInScene = isTherePlayer;

            if (isTherePlayer)
            {
                //Debug.Log ("Setting nexts to " + spawnHereAfter.x + " and " + spawnHereAfter.y);
                GameManager.Instance.SetMainCharacter(whatCharacter);
                GameManager.Instance.SetNextX(spawnHereAfter.x);
                GameManager.Instance.SetNextY(spawnHereAfter.y);
            }
            GameManager.dialogueJustFinished = false;
            SoundManager.Instance.CantWalk();
            Application.LoadLevel(nextLevel);
        }
    }
Esempio n. 27
0
 public void StartDialogue(int id, DialoguerCallback callback)
 {
     Dialoguer.StartDialogue(id, callback);
 }
Esempio n. 28
0
    public void talk(int x, int y, TileData otherTileData)
    {
        Talk talk = otherTileData.gameObject.GetComponent <Talk>();

        Dialoguer.StartDialogue(talk.dialogureID);
    }
Esempio n. 29
0
 void initDialogue(int num)
 {
     Debug.Log("aloha");
     Dialoguer.StartDialogue(num);
 }
Esempio n. 30
0
    void Update()
    {
        if (Input.GetMouseButtonUp(0) && GameController.instance.inventoryController.selectedObj == null)
        {
            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
            if (hit.collider != null)
            {
                if (hit.collider.gameObject == this.gameObject)
                {
//					Debug.Log ("Clicked on: " + this.gameObject.name);
                    if (GameController.instance.currentArea == area)
                    {
                        //if game controller current area == this area && if chracter not moving
                        if (!cMovement.moving)
                        {
                            OpenInteractiveMenu();
                        }
                    }
                    else
                    {
                        if (GameController.instance.playerState == GameController.PlayerState.OpenArea)
                        {
                            if (!cMovement.moving)
                            {
                                if (characterStance == null)
                                {
                                    StartCoroutine(cMovement.FadeOut(areaComponent.standPosition, areaComponent.sortingLayerNr, areaComponent.characterStance, this));
                                }
                                else
                                {
                                    StartCoroutine(cMovement.FadeOut(areaComponent.standPosition, areaComponent.sortingLayerNr, characterStance, this));
                                }
                                GameController.instance.currentArea = area;
                            }
                        }
                        else
                        {
                            OpenInteractiveMenu();
                        }
                    }
                }
            }
        }
        else if (Input.GetMouseButtonUp(0) && GameController.instance.inventoryController.selectedObj != null)
        {
            RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
            if (hit.collider != null)
            {
                if (hit.collider.gameObject == this.gameObject)
                {
                    if (hit.collider.GetComponent <InteractableObject>().clickInventoryItemNeeded.ToString() == GameController.instance.inventoryController.selectedObj.ToString())
                    {
//
                        GameController.instance.interactionMenu.OpenStuff(hit.collider.GetComponent <InteractableObject>(), hit.collider.gameObject);
//						CloseInteractiveMenu();
                        GameController.instance.inventoryController.RemoveFromInventory();
                    }
                    else
                    {
                        Dialoguer.StartDialogue(DialoguerDialogues.Cant);
                        GameController.instance.dCon.obsTextObj.SetActive(true);
                        GameController.instance.inventoryController.selectedObj = null;
                        GameController.instance.inventoryController.highlight.SetActive(false);
                        CloseInteractiveMenu();
                        GameController.instance.interactionMenu.open = true;
                    }
                }
            }
        }
    }