Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
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;
            }
        }