Exemple #1
0
        internal static Msg_RC_CreateNpc BuildCreateNpcMessage(NpcInfo npc)
        {
            Msg_RC_CreateNpc bder = new Msg_RC_CreateNpc();

            bder.npc_id  = npc.GetId();
            bder.unit_id = npc.GetUnitId();
            Vector3 pos = npc.GetMovementStateInfo().GetPosition3D();

            ArkCrossEngineMessage.Position pos_bd = new ArkCrossEngineMessage.Position();
            pos_bd.x            = (float)pos.X;
            pos_bd.z            = (float)pos.Z;
            bder.cur_pos        = pos_bd;
            bder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir();
            bder.link_id        = npc.GetLinkId();
            if (npc.GetUnitId() <= 0)
            {
                bder.camp_id = npc.GetCampId();
            }
            if (npc.OwnerId > 0)
            {
                bder.owner_id = npc.OwnerId;
            }
            bder.level = npc.GetLevel();
            return(bder);
        }