コード例 #1
0
ファイル: Player.cs プロジェクト: howelllucas/Project
        private void Start()
        {
            m_WaveMgr          = Global.gApp.CurScene.GetWaveMgr();
            m_DamageRange      = transform.Find("ModelNode/Damage").gameObject;
            m_Rigidbody2D      = GetComponent <Rigidbody2D>();
            m_CircleCollider2D = GetComponent <CircleCollider2D>();
            m_BackAct          = GetComponent <BeatBackAct>();
            m_BackAct.Init(this, m_Weight);
            m_Carrier    = new CarrieMgr(this);
            m_WeaponMgr  = new FightWeaponMgr(this);
            m_PetMgr     = new FightPetMgr(this);
            m_BuffMgr    = new BuffMgr(this);
            m_PlayerData = new PlayerData(this, m_BuffMgr);
            m_PlayerData.Init();
            m_Fight = new Fight(this);
            m_Fight.SetRotateNode(RoleNode);
            m_WeaponMgr.InitGun();

            //int skillLevel = Global.gApp.gSystemMgr.GetSkillMgr().GetSkillLevel(GameConstVal.SExSpeed);
            //Skill_dataItem skillLevelData = Global.gApp.gGameData.SkillDataConfig.Get(skillLevel);
            //float addParam = (skillLevelData == null) ? 1f : skillLevelData.skill_exspeed[0];
            float addParam = 1.0f + 0.2f * (m_WeaponMgr.GetCombatAttrValue(CombatAttr.CombatAttrType.MoveSpeed) /
                                            (m_WeaponMgr.GetCombatAttrValue(CombatAttr.CombatAttrType.MoveSpeed) + 5.0f *
                                             PlayerDataMgr.singleton.GetPlayerLevel() + 1.0f));

            m_Speed *= addParam;

            Debug.Log("m_Speed " + m_Speed);

            m_GoldRate = 1.0f + m_WeaponMgr.GetCombatAttrValue(Game.CombatAttr.CombatAttrType.Gold_Add);

            Debug.Log("m_GoldRate " + m_GoldRate);
            //m_EnableVIT = (Global.gApp.CurScene.GetPassData().enableVIT != 0);
            //if (m_EnableVIT)
            //{
            //    m_BuffMgr.AddBuff(BuffType.PlayerEnergy, 10, 10);
            //}
            m_InNormalScene = Global.gApp.CurScene.IsNormalPass();
            if (m_InNormalScene)
            {
                m_WeaponMgr.SetCurMainWeaponEnabled(false);
                //m_PetMgr.ChangePet(Global.gApp.gSystemMgr.GetWeaponMgr().GetCurPet());
            }
            //if (m_InitCar != null)
            //{
            //    GameObject CarNode = Global.gApp.gResMgr.InstantiateObj(m_InitCar);
            //    SetCarrier(CarNode, 999999999, 6);
            //}
            SetSafe(true, false);

            //m_Damage = 25 * (1 + 0.25f) ^ (怪攻击等级 - 1);
            MonsterDamage = Mathf.Ceil(25 * Mathf.Pow((1 + 0.25f), (PlayerDataMgr.singleton.StageAtkLevel - 1)));


            Global.gApp.gMsgDispatcher.Broadcast <int, Transform>(MsgIds.AddPlayerHpUi, 0, HPNode);
        }
コード例 #2
0
        public Fight(Player player)
        {
            m_FootEffectNode = player.transform.Find("ModelNode/FootEffect");
            m_GndNode        = player.transform.Find("GndNode");
            m_WeaponMgr      = player.GetWeaponMgr();
            m_WaveMgr        = player.GetWaveMgr();
            m_Carrier        = player.GetCarrier();
            m_Transform      = player.transform;
            m_Player         = player;
            m_Anim           = m_Player.transform.Find("ModelNode/hero").GetComponent <Animator>();
            PlayAnim(GameConstVal.Idle, GameConstVal.Idle);
            m_RadiusSqr = m_Radius * m_Radius;

            GameObject lockEffect = Global.gApp.gResMgr.InstantiateObj("Prefabs/Effect/common/chooseenemy");

            m_LockEnemyEffect = lockEffect.GetComponent <FollowEnemy>();
            lockEffect.transform.SetParent(Global.gApp.gRoleNode.transform, false);
            m_InNormalPassType = Global.gApp.CurScene.IsNormalPass();
            m_PassType         = Global.gApp.CurScene.GetSceneType();
            AdaptFireAngle();
        }