private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { //关闭这个触发器 this.GetComponent <BoxCollider2D>().enabled = false; //产生敌人 CreateEnemy(); if (m_EnemyCount >= 20) { UITool.CreateGossipUI(ENUM_GossipType.SeeManyEnemy); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (m_Locked == false) { m_OpenDoor = true; m_Timer = 0; m_Door01NowPos = m_Door01.transform.position; m_Door02NowPos = m_Door02.transform.position; } else { m_Tip = UITool.CreateTipUI("F"); TipFollowDoor(); } m_EnterTriggerRange = true; } }
private void Update() { m_Timer += Time.deltaTime; if (m_OpenDoor == true) { OpenDoor(); } else { CloseDoor(); } if (m_EnterTriggerRange == true) { if (m_Locked == true) { //显示按F互动的提示 TipFollowDoor(); //如果按了F键 if (Input.GetKeyDown(KeyCode.F)) { //判断是否有资格进入 //如果玩家还没有获取资格 if (PlayerInfo.DoorA == false) { UITool.CreateGossipUICustom("I Need the AchievesRoomCard!"); } else { UITool.CreateGossipUICustom("Woooo!At last the door opened!"); if (m_Tip != null) { Destroy(m_Tip); } m_OpenDoor = true; m_Locked = false; } } } } }
private void JudgeInEnter() { switch (m_Speaker) { case ENUM_Speaker.Scientist_A: if (PlayerInfo.TalkToNpcA == false || PlayerInfo.MissionDoneA == false) { m_Tip = UITool.CreateTipUI("F"); TipFollowNPC(); } break; case ENUM_Speaker.Scientist_B: if (PlayerInfo.TalkToNpcB == false || PlayerInfo.MissionDoneB == false) { m_Tip = UITool.CreateTipUI("F"); TipFollowNPC(); } break; default: break; } }
private void Update() { if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Play) { if (PlayerInfo.GetData == true) { GlobalValue.ChangeGamePhare(ENUM_GamePhase.Settlement); PlayerInfo.RemoveTaskList("Find Data"); } m_InputAxis = GlobalValue.GetInputAxis(); m_Rigid2D.MovePosition(this.transform.position + m_InputAxis * m_Speed * Time.deltaTime); if (m_InputAxis != Vector3.zero) { m_PlayerAni.SetBool("Run", true); } else { m_PlayerAni.SetBool("Run", false); this.transform.rotation = Quaternion.Euler(0, 0, 0); } //玩家移动的时候左右旋转 if (m_InputAxis.x < 0) { this.transform.rotation = Quaternion.Euler(0, 180, 0); m_CanvasPlayer.localRotation = Quaternion.Euler(0, 180, 0); } else { this.transform.rotation = Quaternion.Euler(0, 0, 0); m_CanvasPlayer.localRotation = Quaternion.Euler(0, 0, 0); } } else if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Introduce) { if (Input.anyKeyDown) { UITool.HideNormalPanel(); DialogFormat dialogData = DialogData.GetNextDialogData(ENUM_DialogType.Introduce_Start); if (dialogData == null) { GlobalValue.ChangeGamePhare(ENUM_GamePhase.Play); UITool.HideDialogText(); TaskFormat task = new TaskFormat(); task.TaskName = "Find Data"; task.TaskDescription = "Map Left Up!"; PlayerInfo.AddTaskList(task); } else { UITool.ShowDialogText(dialogData); } } } else if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Talking) { m_InputAxis = Vector2.zero; } else if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Settlement) { //最终结算。 GameObject.Find("Canvas").transform.Find("Panel_Settlement").gameObject.SetActive(true); } }
private void TestGoosipData() { //Debug.Log(GossipData.GetGossipData(ENUM_GossipType.DecreaseRP, 0)); UITool.CreateGossipUI(ENUM_GossipType.DecreaseRP, 0); }
private void JudgeInStay() { Debug.Log(111); switch (m_Speaker) { case ENUM_Speaker.Scientist_A: if (Input.GetKeyDown(KeyCode.F)) { if (PlayerInfo.TalkToNpcA == false) { DialogFormat dialog = DialogData.GetNextDialogData(ENUM_DialogType.PlayerTrigger_A); if (dialog != null) { //显示对话内容 UITool.ShowDialogText(dialog); //更改游戏状态为Talking GlobalValue.ChangeGamePhare(ENUM_GamePhase.Talking); } else { UITool.HideDialogText(); //添加任务 TaskFormat task = new TaskFormat(); task.TaskName = "Find Food"; task.TaskDescription = "Map Right UP And Right Middle"; PlayerInfo.AddTaskList(task); //更新玩家数据 PlayerInfo.TalkToNpcA = true; //更改游戏状态为Play GlobalValue.ChangeGamePhare(ENUM_GamePhase.Play); //告诉你食物的位置 UITool.ShowFoodInMap(); } } else if (PlayerInfo.MissionDoneA == false) { if (PlayerInfo.Food > 0) { --PlayerInfo.Food; //任务奖励,告诉你注射剂的位置 UITool.ShowIntectionInMap(); PlayerInfo.MissionDoneA = true; //取消任务 PlayerInfo.RemoveTaskList("Find Food"); } else { UITool.CreateGossipUICustom("I need find food!"); } } else { UITool.CreateGossipUICustom("There is no task here!"); } } break; case ENUM_Speaker.Scientist_B: if (Input.GetKeyDown(KeyCode.F)) { if (PlayerInfo.TalkToNpcB == false) { DialogFormat dialog = DialogData.GetNextDialogData(ENUM_DialogType.PlayerTrigger_B); if (dialog != null) { //显示对话内容 UITool.ShowDialogText(dialog); GlobalValue.ChangeGamePhare(ENUM_GamePhase.Talking); } else { UITool.HideDialogText(); //添加任务 TaskFormat task = new TaskFormat(); task.TaskName = "Find Food2"; task.TaskDescription = "Map Right"; PlayerInfo.AddTaskList(task); //更新玩家数据 PlayerInfo.TalkToNpcB = true; GlobalValue.ChangeGamePhare(ENUM_GamePhase.Play); } } else if (PlayerInfo.MissionDoneB == false) { if (PlayerInfo.Food > 0) { --PlayerInfo.Food; //任务奖励,拥有上锁的门的钥匙 PlayerInfo.DoorA = true; PlayerInfo.MissionDoneB = true; //取消任务 PlayerInfo.RemoveTaskList("Find Food2"); } else { UITool.CreateGossipUICustom("I need find food!"); } } else { UITool.CreateGossipUICustom("There is no task here!"); } } break; default: break; } }