Esempio n. 1
0
        private void Update()
        {
            if (GlobalValue.GetCurrentGamePhase() == ENUM_GamePhase.Play)
            {
                GetWeaponRotation();
                if (Input.GetMouseButtonDown(0))
                {
                    //播放动画
                    m_WeaponAni.SetTrigger("Attack");
                    //产生子弹
                    CreateButtel();
                    //播放音效
                    m_Audio.Play();
                }

                //武器跟随鼠标旋转
                if (m_WeaponRotation < -90 || m_WeaponRotation > 90)
                {
                    this.transform.rotation = Quaternion.Euler(0, 180, 180 - m_WeaponRotation);
                }
                else
                {
                    this.transform.rotation = Quaternion.Euler(0, 0, m_WeaponRotation);
                }
            }
        }
        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);
            }
        }