Пример #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         RookieModule _rookieModule = (RookieModule)GameManager.GameManagerObj.GetComponent <GameManager>().GetModuleByName("RookieModule");
         _rookieModule.RemoveRookieEnemy(m_id);
         GameObject.Destroy(gameObject);
     }
 }
Пример #2
0
 private void UseSkill(EventArgs args)
 {
     m_state   = State.UseSkill;
     m_skillId = (SkillId)((IntEventArgs)args).m_args;
     AudioFx.Instance.clickskill((int)m_skillId);
     if (GameManager.SceneConfigId == 0)
     {
         RookieModule _rookieModule = (RookieModule)GameManager.GameManagerObj.GetComponent <GameManager>().GetModuleByName("RookieModule");
         _rookieModule.ChangeMap(m_skillId);
     }
     else
     {
         SceneModule _sceneModule = (SceneModule)GameManager.GameManagerObj.GetComponent <GameManager>().GetModuleByName("SceneModule");
         _sceneModule.ChangeMap(m_skillId, m_playerPos.m_row, m_playerPos.m_col);
     }
 }
Пример #3
0
        private void LoadModuleByName(ModuleId id)
        {
            switch (id)
            {
            case ModuleId.ErrorModule:
                Debug.Log("Error Module Id");
                break;

            case ModuleId.LoginModule:
                LoginModule _loginModule = CreateInstance <LoginModule>();
                _loginModule.enabled = true;
                m_moduleList.Add(_loginModule);
                break;

            case ModuleId.MainMenuModule:
                MainMenuModule _mainMenuModule = CreateInstance <MainMenuModule>();
                _mainMenuModule.enabled = true;
                m_moduleList.Add(_mainMenuModule);
                LoadBGM(0);
                break;

            case ModuleId.SceneModule:
                SceneModule _sceneModule = CreateInstance <SceneModule>();
                _sceneModule.enabled = true;
                m_moduleList.Add(_sceneModule);
                break;

            case ModuleId.RookieModule:
                RookieModule _rookieModule = CreateInstance <RookieModule>();
                _rookieModule.enabled = true;
                m_moduleList.Add(_rookieModule);
                break;

            default:
                break;
            }
            return;
        }
Пример #4
0
        private void Update()
        {
            if (Input.GetMouseButton(0) && m_move && m_skillId != SkillId.NONE)
            {
                Ray        _ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit _hit;
                int        _layerMask = 1 << 8;
                if (Physics.Raycast(_ray, out _hit, 100, _layerMask))
                {
                    if (_hit.collider.gameObject.tag.Equals("Plane"))
                    {
                        MapData _data = _hit.transform.GetComponent <MapData>();
                        if (CheckCanMove(_data.Pos.m_row, _data.Pos.m_col, _data.Data))
                        {
                            if (GameManager.SceneConfigId == 0)
                            {
                                RookieModule _rookieModule = (RookieModule)GameManager.GameManagerObj.GetComponent <GameManager>().GetModuleByName("RookieModule");
                                _rookieModule.RefreshMap();
                            }
                            else
                            {
                                SceneModule _sceneModule = (SceneModule)GameManager.GameManagerObj.GetComponent <GameManager>().GetModuleByName("SceneModule");
                                _sceneModule.RefreshMap();
                            }

                            IntEventArgs args = new IntEventArgs((int)m_skillId);
                            EventManager.SendEvent(HLEventId.PLAYER_START_MOVE, args);
                            m_state = State.Move;

                            float _targetPosX = _data.Pos.m_row * DiffX;
                            float _targetPosZ = _data.Pos.m_col * DiffZ;
                            if (m_skillId == SkillId.JU)
                            {
                                MissionList.Instance.jutimes++;
                                MissionList.Instance.Judgemission();
                                Sequence _sequence = DOTween.Sequence();
                                _sequence.Append(transform.DOMove(new Vector3(_targetPosX, this.transform.position.y, _targetPosZ), 0.4f).SetEase(m_juCurve));
                                _sequence.AppendCallback(MoveEnd);
                                _sequence.SetAutoKill(true);
                            }
                            else if (m_skillId == SkillId.MA || m_skillId == SkillId.PAO)
                            {
                                MissionList.Instance.matimes++;
                                MissionList.Instance.Judgemission();
                                float _targetPosY = 0f;
                                if (_data.Data == MapDataType.GAOTAI)
                                {
                                    _targetPosY = 1.0f;
                                }
                                float _midTargetPosX = 0.0f;
                                float _midTargetPosZ = 0.0f;
                                if (_data.Pos.m_row == m_playerPos.m_row + 2)
                                {
                                    _midTargetPosX = (m_playerPos.m_row + 1) * DiffX;
                                    _midTargetPosZ = this.transform.position.z;
                                }
                                else if (_data.Pos.m_row == m_playerPos.m_row - 2)
                                {
                                    _midTargetPosX = (m_playerPos.m_row - 1) * DiffX;
                                    _midTargetPosZ = this.transform.position.z;
                                }
                                else if (_data.Pos.m_col == m_playerPos.m_col + 2)
                                {
                                    _midTargetPosX = this.transform.position.x;
                                    _midTargetPosZ = (m_playerPos.m_col + 1) * DiffZ;
                                }
                                else if (_data.Pos.m_col == m_playerPos.m_col - 2)
                                {
                                    _midTargetPosX = this.transform.position.x;
                                    _midTargetPosZ = (m_playerPos.m_col - 1) * DiffZ;
                                }
                                Sequence _sequence = DOTween.Sequence();
                                _sequence.Append(transform.DOMove(new Vector3(_midTargetPosX, this.transform.position.y, _midTargetPosZ), 0.3f).SetEase(m_maCurve1));
                                _sequence.Append(transform.DOJump(new Vector3(_targetPosX, _targetPosY, _targetPosZ), 0.4f, 1, 0.3f).SetEase(m_maCurve2));
                                _sequence.AppendCallback(MoveEnd);
                                _sequence.SetAutoKill(true);
                            }
                            else if (m_skillId == SkillId.XIANG)
                            {
                                MissionList.Instance.xiangtimes++;
                                MissionList.Instance.Judgemission();
                                float _targetPosY = 0f;
                                if (_data.Data == MapDataType.GAOTAI)
                                {
                                    _targetPosY = 1.0f;
                                }
                                Sequence _sequence = DOTween.Sequence();
                                _sequence.Append(transform.DOJump(new Vector3(_targetPosX, _targetPosY, _targetPosZ), 0.4f, 1, 0.5f).SetEase(m_xiangCurve));
                                _sequence.AppendCallback(MoveEnd);
                                _sequence.SetAutoKill(true);
                            }
                            m_skillId         = SkillId.NONE;
                            m_playerPos.m_row = _data.Pos.m_row;
                            m_playerPos.m_col = _data.Pos.m_col;
                        }
                    }
                }
            }
        }