예제 #1
0
        //生物id
        public override void Init(int resID, int configID, long entityID, string strEnterAction = "", bool isNpc = false)
        {
            //m_shadowType = GameGraphicSetting.IsLowQuality ? 1 : 2;
            m_shadowType = 1;

            InitAutoMove();
            base.Init(resID, configID, MainRole.Instance.serverID, strEnterAction, isNpc);
            mActorType = ActorType.AT_LOCAL_PLAYER;
            mBaseAttr.InitFromPlayerData();
            m_bodyType = 3;
            m_TeamType = 1;

            ServerID = MainRole.Instance.serverID;
            mDestPos = Vector3.zero;

            m_move = this.gameObject.GetComponent <MoveController>();
            if (m_move == null)
            {
                m_move = this.gameObject.AddComponent <MoveController>();
            }
            m_move.DoInit(this);

            //设置跑步速度 addby yuxj

            mBaseAttr.Speed = 4.0f;

            SetSpeed(mBaseAttr.Speed);

            m_skillGiftsMgr = null;

            //初始化后回调

            OnPostInit();


            ////通用逻辑要写到这行之上##########################
            if (isNpc || !IsMainPlayer())
            {
                return;
            }

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                m_touchMove         = this.gameObject.AddComponent <TouchMove>();
                m_touchMove.enabled = false;
            }


            ReBindSkill();
            mHealth.OnCreateHPBar();

            //常量表读取三个距离配置
            m_CancelPlayerTargetDis  = ConfigManager.Instance.Consts.GetValue <float>("playerDistance", "val1");
            m_CancelMonsterTargetDis = ConfigManager.Instance.Consts.GetValue <float>("monsterDistance", "val1");
            m_SkillSelectDis         = ConfigManager.Instance.Consts.GetValue <float>("attackDistance", "val1");

            CommonTools.SetLayer(this.gameObject, LayerMask.NameToLayer("mainplayer"));
        }
예제 #2
0
        //生物id
        public override void Init(int resID, int configID, long entityID, string strEnterAction = "", bool isNpc = false)
        {
            base.Init(resID, configID, entityID, strEnterAction, isNpc);        //此函数会读取配置表修改mActorType
            mActorType = ActorType.AT_REMOTE_PLAYER;

            m_bodyType = 3;
            m_TeamType = 3;
            //add by Alex 20150324 使用这个接口修改本地玩家类型为无人控制的pvp玩家


            if (isNpc)
            {
                mActorType = ActorType.AT_PVP_PLAYER;
                TeamType   = 3; //敌对阵营
            }

            if (ArenaMgr.Instance.IsArenaFight)
            {
                m_move = this.gameObject.GetComponent <ServerMoveAgent>();
                if (m_move == null)
                {
                    m_move = this.gameObject.AddComponent <ServerMoveAgent>();
                }
                m_move.DoInit(this);
            }
            else
            {
                m_move = this.gameObject.GetComponent <ServerMoveAgent>();
                if (m_move == null)
                {
                    m_move = this.gameObject.AddComponent <ServerMoveAgent>();
                }
                m_move.DoInit(this);
            }

            mBaseAttr.Speed = 4.0f;

            SetSpeed(mBaseAttr.Speed);


            OnPostInit();

            if (Application.platform == RuntimePlatform.WindowsEditor)
            {
                m_touchMove = this.gameObject.AddComponent <TouchMove>();
                m_touchMove.SetCallbackMoveFun(MoveToPos);
                m_touchMove.enabled = false;
            }
            mHealth.OnCreateHPBar();

            CommonTools.SetLayer(this.gameObject, LayerMask.NameToLayer("player"));
        }