Пример #1
0
        protected virtual bool InitTplData(IActorInitBase initBase)
        {
            var init = initBase as NpcInit;

            if (null == init)
            {
                return(false);
            }

            mNpcData.TemplateId = init.Data.tid;
            if (null == NPCData.Template)
            {
                return(false);
            }

            mNpcData.RoleName = NPCData.Template.name;
            mDeadBodyTime     = mNpcData.Template.deadBodyTime;
            SkillMgr.Init(this, mNpcData);

            mCurrentSpellID    = SkillMgr.getElementByIndex(0).ID;
            mCastSpellDistance = NPCData.Template.distance;
            mSpellType         = (ushort)eSkillTargetType.Enemy;

            BaseGameLogic <INPCLogic> bgLogic = (BaseGameLogic <INPCLogic>)GameLogicManager.Instance.GetGameLogic(eGameLogicType.NPCLogic, (short)mNpcData.Template.logic);

            if (null != bgLogic)
            {
                mLogic = bgLogic.Logic;
            }

            mState = eNPCState.Idle;

            return(true);
        }
Пример #2
0
        protected virtual bool InitMapData(IActorInitBase initBase)
        {
            var init = initBase as NpcInit;

            if (null == init)
            {
                return(false);
            }

            InMapData         = init.Data;
            OwnerMapData      = init.OwnerMapData;
            mSpawnPoint       = new Vector3(InMapData.posX, 0, InMapData.posZ);
            mNpcData.ActionId = InMapData.actionId;
            mNpcData.Camp     = (byte)InMapData.camp;
            InMapData.level   = InMapData.level > 0 ? InMapData.level : 1;
            if (InMapData.followRange < 0)
            {
                InMapData.followRange = float.MaxValue;
            }
            if (InMapData.followRange < InMapData.patrolRange)
            {
                InMapData.patrolRange = InMapData.followRange;
            }
            AttriData = CSTable.StaticDataManager.NPC_Attri[mNpcData.Template.type, InMapData.level];
            if (AttriData == null)
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        public override bool Initialize(IActorInitBase initBase)
        {
            mBuffMgr.SetOwner(this);
            mPlayerStatus.CleanUp();
            if (!base.Initialize(initBase))
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
        public static PlayerInstance CreatePlayerInstance(CSCommon.Data.PlayerData pd, Iocp.TcpConnect p2gConnect, UInt16 linkId)
        {
            IActorInitBase actInit = new IActorInitBase();

            actInit.GameType = eActorGameType.Player;
            PlayerInstance ret = new PlayerInstance();

            ret.Initialize(actInit);
            if (false == ret.InitRoleInstance(null, pd, p2gConnect, linkId))
            {
                return(null);
            }

            return(ret);
        }
Пример #5
0
        public override bool Initialize(IActorInitBase init)
        {
            base.Initialize(init);

            WayPointInit myInit = init as WayPointInit;

            if (myInit == null || myInit.PatrolNode == null)
            {
                return(false);
            }
            mPatrolNodeData = myInit.PatrolNode;
            var pos = new SlimDX.Vector3(mPatrolNodeData.posX, 0, mPatrolNodeData.posZ);

            mPlacement.SetLocation(ref pos);

            return(true);
        }
Пример #6
0
        public override bool Initialize(IActorInitBase init)
        {
            base.Initialize(init);

            TriggerInit myInit = init as TriggerInit;

            if (myInit == null || myInit.PortalDate == null)
            {
                return(false);
            }
            mTriggerData = myInit.PortalDate;
            var pos = new SlimDX.Vector3(mTriggerData.posX, 0, mTriggerData.posZ);

            mPlacement.SetLocation(ref pos);
            //mScript = new PortalScript();

            return(true);
        }
Пример #7
0
        protected override bool InitTplData(IActorInitBase initBase)
        {
            var init = initBase as NpcInit;

            if (null == init)
            {
                return(false);
            }

            mNpcData.TemplateId = init.Data.tid;
            BaseGameLogic <INPCLogic> bgLogic = (BaseGameLogic <INPCLogic>)GameLogicManager.Instance.GetGameLogic(eGameLogicType.NPCLogic, (short)eNPCLogicType.PlayerImage);

            if (null == bgLogic)
            {
                return(false);
            }

            mLogic             = bgLogic.Logic;
            mNpcData.RoleMaxHp = mPlayerData.value.MaxHP;
            mState             = eNPCState.None;

            return(true);
        }
Пример #8
0
        public override bool Initialize(IActorInitBase initBase)
        {
            if (!base.Initialize(initBase))
            {
                return(false);
            }

            if (!InitNpcData())
            {
                return(false);
            }

            if (!InitTplData(initBase))
            {
                return(false);
            }

            if (!InitMapData(initBase))
            {
                return(false);
            }

            return(true);
        }
Пример #9
0
 public virtual bool Initialize(IActorInitBase init)
 {
     mActorInit = init;
     mPlacement = new RolePlacement(this);
     return(true);
 }