示例#1
0
 public void PlayDialogue(DialoguerDialogues dialogue)
 {
     if (PauseGameWhenPlayingDialogue)
     {
         gameMgr.PauseGame();
     }
     dialogueGUI.DialogueCanvas.SetActive(true);
     dialogueGUI.PlayDialogue(dialogue);
 }
    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();
        }
    }
    public void StartDialog(DialoguerDialogues dialog)
    {
        if (GetPlayerMove())
        {
            Dialoguer.events.ClearAll();
            addDialoguerEvents();
            Dialoguer.StartDialogue(dialog);

            // Disable player
            SetPlayerMove(false);
        }
    }
    public void StartDialog(DialoguerDialogues dialog)
    {
        if (GetPlayerMove())
        {
            Dialoguer.events.ClearAll();
            addDialoguerEvents();
            Dialoguer.StartDialogue(dialog);

            // Disable player
            SetPlayerMove(false);
        }
    }
示例#5
0
	/// <summary>
	/// Start a Dialogue
	/// </summary>
	/// <param name="dialogue">Dialogue from the DialoguerDialogues enum</param>
	/// <param name="callback">Callback to be called when diaogue is finished.</param>
	public static void StartDialogue(DialoguerDialogues dialogue, DialoguerCallback callback){
		DialoguerDialogueManager.startDialogueWithCallback((int)dialogue, callback); 
	}
示例#6
0
	/// <summary>
	/// Start a Dialogue
	/// </summary>
	/// <param name="dialogue">Dialogue from the DialoguerDialogues enum</param>
	public static void StartDialogue(DialoguerDialogues dialogue){
		DialoguerDialogueManager.startDialogue((int)dialogue); 
	}
示例#7
0
 public void PlayDialogue(DialoguerDialogues dialogue)
 {
     Dialoguer.StartDialogue(dialogue);
 }
示例#8
0
 /// <summary>
 /// Start a Dialogue
 /// </summary>
 /// <param name="dialogue">Dialogue from the DialoguerDialogues enum</param>
 /// <param name="callback">Callback to be called when diaogue is finished.</param>
 public static void StartDialogue(DialoguerDialogues dialogue, DialoguerCallback callback)
 {
     DialoguerDialogueManager.startDialogueWithCallback((int)dialogue, callback);
 }
示例#9
0
 /// <summary>
 /// Start a Dialogue
 /// </summary>
 /// <param name="dialogue">Dialogue from the DialoguerDialogues enum</param>
 public static void StartDialogue(DialoguerDialogues dialogue)
 {
     DialoguerDialogueManager.startDialogue((int)dialogue);
 }
    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 ());
                }
            }
        }
    }