EncodeFloat() public static method

public static EncodeFloat ( float value ) : int
value float
return int
示例#1
0
        public static Msg_RC_NpcFace BuildNpcFaceMessage(EntityInfo npc)
        {
            Msg_RC_NpcFace npcFaceBuilder = new Msg_RC_NpcFace();

            npcFaceBuilder.npc_id         = npc.GetId();
            npcFaceBuilder.face_direction = ProtoHelper.EncodeFloat(npc.GetMovementStateInfo().GetFaceDir());
            return(npcFaceBuilder);
        }
示例#2
0
        public static Msg_RC_NpcSkill BuildNpcSkillMessage(EntityInfo obj, int skillId)
        {
            MovementStateInfo msi = obj.GetMovementStateInfo();

            ScriptRuntime.Vector3 pos = msi.GetPosition3D();

            Msg_RC_NpcSkill msg = new Msg_RC_NpcSkill();

            msg.npc_id         = obj.GetId();
            msg.skill_id       = skillId;
            msg.stand_pos      = ProtoHelper.EncodePosition2D(pos.X, pos.Z);
            msg.face_direction = ProtoHelper.EncodeFloat(msi.GetFaceDir());
            msg.target_id      = obj.GetAiStateInfo().Target;

            return(msg);
        }
示例#3
0
        public static Msg_RC_NpcMove BuildNpcMoveMessage(EntityInfo npc)
        {
            ScriptRuntime.Vector3 srcPos         = npc.GetMovementStateInfo().GetPosition3D();
            Msg_RC_NpcMove        npcMoveBuilder = new Msg_RC_NpcMove();

            if (npc.GetMovementStateInfo().IsMoving)
            {
                npcMoveBuilder.npc_id   = npc.GetId();
                npcMoveBuilder.velocity = ProtoHelper.EncodeFloat(npc.ActualProperty.GetFloat(CharacterPropertyEnum.x2011_最终速度));
                ScriptRuntime.Vector3 targetPos = npc.GetMovementStateInfo().TargetPosition;
                npcMoveBuilder.target_pos = ProtoHelper.EncodePosition2D(targetPos.X, targetPos.Z);
                npcMoveBuilder.cur_pos    = ProtoHelper.EncodePosition2D(srcPos.X, srcPos.Z);
            }
            else
            {
                npcMoveBuilder.npc_id  = npc.GetId();
                npcMoveBuilder.cur_pos = ProtoHelper.EncodePosition2D(srcPos.X, srcPos.Z);
            }
            return(npcMoveBuilder);
        }