void OnTriggerEnter(Collider collider) { if (collider.tag == "Player") { nextDialog = true; if (!canMoveHere) { string playerPath = CharactersConfigManager.GetCharacterGameObjectPath(CharactersConfigManager.k_PlayerID); List <int> blockstate = new List <int>(); blockstate.Add(0); GameObject.Find(playerPath).GetComponent <PlayerTestController>().BlockPlayerInput(blockstate); } } }
// Update is called once per frame void Update() { if (bubble && curSpeakingTransform) { //float yOffset = curSpeakingTransform.gameObject.GetComponent<Renderer>().bounds.size.y; bubble.transform.position = Camera.main.WorldToScreenPoint(curSpeakingTransform.position + new Vector3(0, 0, 0)); } if (canInput && (Input.GetKey(KeyCode.F5) || Input.GetMouseButtonDown(0))) { nextDialog = true; } if (nextDialog) { string playerPath = CharactersConfigManager.GetCharacterGameObjectPath(CharactersConfigManager.k_PlayerID); // if (!canMoveHere) // { // List<int> blockstate = new List<int>(); // blockstate.Add(0); // GameObject.Find(playerPath).GetComponent<PlayerTestController>().BlockPlayerInput(blockstate); // } nextDialog = false; if (index == dialogList.Count) { Debug.Log("dialog ends"); canInput = false; if (bubble) { Destroy(bubble); } if (!canMoveHere) { Debug.Log("%%%%%%%%%%%%%%%restore"); List <int> blockstate = new List <int>(); blockstate.Add(0); GameObject.Find(playerPath).GetComponent <PlayerTestController>().UnblockPlayerInput(blockstate); } landBreak.cs.doShake = true; landBreak.startTime = Time.time; return; } DialogStruct dialog = dialogList[index]; if (dialog.speakerID != curSpeakerId) // new speaker { if (bubble) { Destroy(bubble); } Debug.Log(dialog.speakerID); curSpeakerId = dialog.speakerID; bubble = Instantiate(Resources.Load("Prefabs/DialogBubble")) as GameObject; Debug.Log(bubble); bubble.transform.SetParent(GameObject.Find("Canvas").transform); //curBubbleTransform = bubble.transform; string objectName = CharactersConfigManager.GetCharacterGameObjectPath(dialog.speakerID); curSpeakingTransform = GameObject.Find(objectName).transform; bubble.GetComponent <BubbleEffectController>().setSaySomething(dialog.content); string speakerName = CharactersConfigManager.GetCharacterName(dialog.speakerID); bubble.GetComponent <BubbleEffectController>().setName(speakerName); string spritePath = CharactersConfigManager.GetCharacterSpritePath(dialog.speakerID); bubble.GetComponent <BubbleEffectController>().setHead(spritePath); canInput = false; Invoke("EnableInput", 0.5f); curSpeakerId = dialog.speakerID; } else { bubble.GetComponent <BubbleEffectController>().setSaySomething(dialog.content); canInput = false; Invoke("EnableInput", 0.5f); } index++; } }