示例#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
 public override void Recover()
 {
     // 天赋技能
     if (m_skillGiftsMgr == null)
     {
         m_skillGiftsMgr = new SkillGiftsMgr();
         m_skillGiftsMgr.Init(this, false);
     }
     m_skillGiftsMgr.Recover(this);
 }
示例#3
0
        void Start()
        {
            lastTime    = Time.time;
            m_ch        = this.gameObject.GetComponent <CharacterController>();
            Random.seed = System.Guid.NewGuid().GetHashCode();


            //注册事件
            RegisterEvent();


            //脚步声
            InvokeRepeating("PlayerRunSound", 1, 0.1f);

            if (m_skillGiftsMgr == null)
            {
                m_skillGiftsMgr = new SkillGiftsMgr();
                m_skillGiftsMgr.Init(this, false);
            }
            m_skillGiftsMgr.OnEnter(this);
        }