void Update() { Camera.main.transform.position -= new Vector3(Time.deltaTime * 1f, 0, 0); if (Input.GetKeyDown(KeyCode.N)) { skill01.GetSkill(); } if (Input.GetKeyDown(KeyCode.B)) { skill01.UseSkill(); } if (Input.GetKeyDown(KeyCode.V)) { skill02.GetSkill(); } if (Input.GetKeyDown(KeyCode.K)) { zimuUI.Show("瓶装水"); } /*if (Input.GetKeyDown(KeyCode.O)) * { * getOrLostItem.GetShow("瓶装水",5f); * } * if (Input.GetKeyDown(KeyCode.P)) * { * getOrLostItem.LostShow("罐头"); * }*/ if (Input.GetKeyDown(KeyCode.U)) { bubbleHintUI.ShowAndHide("罐头"); } if (Input.GetKeyDown(KeyCode.L)) { GameObject.Find("BackpackUI/Canvas/Note").transform.GetComponent <NoteUI>().Show("罐头", 2f); } if (Input.GetKeyDown(KeyCode.M)) { Debug.Log("Input M"); Debug.Log(Time.timeScale); GameObject.Find("n格漫画UI").transform.GetComponent <CartoonUI>().Show(5); } if (Input.GetKeyDown(KeyCode.R)) { GameObject.Find("BackpackUI").GetComponent <BackpackUI>().AddItem("炸弹"); } if (Input.GetKeyDown(KeyCode.T)) { GameObject.Find("BackpackUI").GetComponent <BackpackUI>().RemoveItem("炸弹"); } if (Input.GetKeyUp(KeyCode.Q)) { Debug.Log("Input Q"); TransitionUI.FadeOut(); } }
void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { player = collision.gameObject; is_inBounds = true; if (interaction_type != 17 && gameObject.transform.GetChild(1).gameObject.activeInHierarchy) { remind = Instantiate(remind_prefab, remind_position); if (getOrLose_prefab != null) { getOrLose = Instantiate(getOrLose_prefab); getOrLostItem = getOrLose.GetComponent <GetOrLostItem>(); getOrLostItem.character = player.transform; } m_AudioSourceController = AudioSourcesManager.ApplyAudioSourceController(); } else if (interaction_type == 17 && !gameObject.transform.GetChild(1).gameObject.activeInHierarchy) { remind = Instantiate(remind_prefab, remind_position); if (getOrLose_prefab != null) { getOrLose = Instantiate(getOrLose_prefab); getOrLostItem = getOrLose.GetComponent <GetOrLostItem>(); getOrLostItem.character = player.transform; } m_AudioSourceController = AudioSourcesManager.ApplyAudioSourceController(); } if (interaction_type == 5) { remind = Instantiate(remind_prefab); remind.transform.parent = player.transform; remind.transform.localPosition = new Vector3(0f, 3f, 0f); remind.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f); remind.GetComponent <ShowAndHide>().Show(1f); zimu.Show("太危险了!可是必须要过去。"); return; } } }
private void Update() { Vector3 playerWordDir = Camera.main.WorldToScreenPoint(new Vector3(0, 0, 0f)); Vector3 mousePosition = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, playerWordDir.z)); switch (interaction_type) { case 1: if (transform.parent.GetComponent <Collider2D>().bounds.Contains(mousePosition)) { if (!action_finished) { GameObject.Find("MouseCursor").GetComponent <MouseCursorController>().InterationPrompt(); } InputController.GetKey(); if (!dog_inBounds) { return; } if (m_dog.GetComponent <PlayerActions>().GetInteraction() && !action_finished) { action_finished = true; m_AudioSourceController.Play("碎石", transform); GameObject.Find("MouseCursor").GetComponent <MouseCursorController>().EnterPointPlane(); Transform stone = transform.parent; stone.GetChild(1).GetComponent <ShowAndHide>().Hide(3f); stone.GetChild(2).gameObject.SetActive(true); stone.GetChild(2).GetComponent <ShowAndHide>().Show(3f); StartCoroutine(DelayToInvoke.DelayToInvokeDo(() => { m_dog.GetComponent <DogMoving>().StopMoving(); gameObject.SetActive(false); stone.GetComponent <Collider2D>().isTrigger = true; }, 3f)); } } else { GameObject.Find("MouseCursor").GetComponent <MouseCursorController>().EnterPointPlane(); } break; case 3: if (transform.parent.GetComponent <Collider2D>().bounds.Contains(mousePosition)) { if (!action_finished) { GameObject.Find("MouseCursor").GetComponent <MouseCursorController>().InterationPrompt(); } InputController.GetKey(); if (!dog_inBounds) { return; } if (m_dog.GetComponent <PlayerActions>().GetInteraction() && !action_finished) { GetSomething("零件"); GameObject.Find("箱子").GetComponent <Collider2D>().enabled = false; transform.parent.GetChild(2).GetComponent <Collider2D>().enabled = false; GameObject.Find("BackpackUI").GetComponent <BackpackUI>().AddItem("零件"); GameObject.Find("MouseCursor").GetComponent <MouseCursorController>().EnterPointPlane(); zimu.Show("拿到了零件!可以修理一下轮椅了。"); GameObject.Find("CameraAndCharacterController").GetComponent <CameraAndCharacterController>().SendMessage("LookAtMan"); } } else { GameObject.Find("MouseCursor").GetComponent <MouseCursorController>().EnterPointPlane(); } break; case 4: if (transform.parent.GetComponent <Collider2D>().bounds.Contains(mousePosition)) { GameObject.Find("MouseCursor").GetComponent <MouseCursorController>().InterationPrompt(); } else { GameObject.Find("MouseCursor").GetComponent <MouseCursorController>().EnterPointPlane(); } break; default: break; } }