Exemplo n.º 1
0
 public override void Encode()
 {
     base.Encode();
     bool[] posxbit   = FreedomAIEncoderAndDecoder.float2BitBunch(mPosition.x, mpos_leftdown.x, mpos_rightup.x, 11);
     bool[] poszbit   = FreedomAIEncoderAndDecoder.float2BitBunch(mPosition.z, mpos_leftdown.z, mpos_rightup.z, 11);
     bool[] lifebit   = FreedomAIEncoderAndDecoder.int2BitBunch(mLife, 1000, 2000, 10);
     bool[] strongbit = FreedomAIEncoderAndDecoder.float2BitBunch(mStrongRate, 0.0f, 1.0f, 11);
     mbitbunch = FreedomAIEncoderAndDecoder.JointBitBunch(posxbit, poszbit, lifebit, strongbit);
 }
Exemplo n.º 2
0
 public override void Encode()
 {
     //	Debug.Log (mColor);
     bool[] mColorBit   = FreedomAIEncoderAndDecoder.float2BitBunch(mColor, 0.0f, 1.0f, 11);
     bool[] mHeight_Bit = FreedomAIEncoderAndDecoder.float2BitBunch(mHeight, 1.0f, 2.5f, 11);
     bool[] mAllhp_Bit  = FreedomAIEncoderAndDecoder.int2BitBunch(mAllhp, 2000, 4000, 11);
     bool[] mPosition_X = FreedomAIEncoderAndDecoder.float2BitBunch((mPosition.x - mpos_leftdown.x) / (mpos_rightup.x - mpos_leftdown.x), 0.0f, 1.0f, 11);
     bool[] mPosition_Z = FreedomAIEncoderAndDecoder.float2BitBunch((mPosition.z - mpos_leftdown.z) / (mpos_rightup.z - mpos_leftdown.z), 0.0f, 1.0f, 11);
     mbitbunch = FreedomAIEncoderAndDecoder.JointBitBunch(mColorBit, mHeight_Bit, mAllhp_Bit, mPosition_X, mPosition_Z);
 }
Exemplo n.º 3
0
 public override void Encode()
 {
     bool[] tStrongRate_bit = FreedomAIEncoderAndDecoder.float2BitBunch(mStrongRate, 0.0f, 1.0f, 10);
     bool[] tVelocity_bit   = FreedomAIEncoderAndDecoder.float2BitBunch(mVelocity, 6.0f, 9.0f, 10);
     bool[] tLife           = FreedomAIEncoderAndDecoder.int2BitBunch(mLife, 1000, 2000, 10);
     bool[] mPosition_X     = FreedomAIEncoderAndDecoder.float2BitBunch((mPosition.x - mpos_leftdown.x) / (mpos_rightup.x - mpos_leftdown.x), 0.0f, 1.0f, 11);
     bool[] mPosition_Z     = FreedomAIEncoderAndDecoder.float2BitBunch((mPosition.z - mpos_leftdown.z) / (mpos_rightup.z - mpos_leftdown.z), 0.0f, 1.0f, 11);
     bool[] mType           = FreedomAIEncoderAndDecoder.bool2BitBunch(Type);
     mbitbunch = FreedomAIEncoderAndDecoder.JointBitBunch(tStrongRate_bit, tVelocity_bit, tLife, mPosition_X, mPosition_Z, mType);
 }
Exemplo n.º 4
0
        public override void Decode()
        {
            bool[][] mAllBitBunch = FreedomAIEncoderAndDecoder.BreakBitBunch(mbitbunch, mBreakPoint);

            mColor  = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[0], 0.0f, 1.0f);
            mHeight = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[1], 1.0f, 2.5f);
            mAllhp  = FreedomAIEncoderAndDecoder.BitBunch2int(mAllBitBunch[2], 2000, 4000);
            float tx = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[3], 0.0f, 1.0f); tx = (mpos_rightup.x - mpos_leftdown.x) * tx + mpos_leftdown.x;
            float tz = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch [4], 0.0f, 1.0f); tz = (mpos_rightup.z - mpos_leftdown.z) * tz + mpos_leftdown.z;

            mPosition = new Vector3(tx, mpos_rightup.y, tz);
            mHp       = mAllhp;
        }
Exemplo n.º 5
0
        public override void Decode()
        {
            bool[][] mAllBitBunch = FreedomAIEncoderAndDecoder.BreakBitBunch(mbitbunch, mBreakPoint);
            string   s            = "";

            mStrongRate = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[0], 0.0f, 1.0f);
            mVelocity   = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[1], 6.0f, 9.0f);
            mLife       = FreedomAIEncoderAndDecoder.BitBunch2int(mAllBitBunch[2], 1000, 2000); mTempLife = mLife;
            float tx = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[3], 0.0f, 1.0f); tx = (mpos_rightup.x - mpos_leftdown.x) * tx + mpos_leftdown.x;
            float tz = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch [4], 0.0f, 1.0f); tz = (mpos_rightup.z - mpos_leftdown.z) * tz + mpos_leftdown.z;

            Type      = FreedomAIEncoderAndDecoder.BitBunch2bool(mAllBitBunch[5]);
            mPosition = new Vector3(tx, mpos_rightup.y, tz);
        }
Exemplo n.º 6
0
        public override void Decode()
        {
            base.Decode();
            bool[][] mAllBitBunch = FreedomAIEncoderAndDecoder.BreakBitBunch(mbitbunch, mBreakPoint);
            float    posx         = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[0], mpos_leftdown.x, mpos_rightup.x);
            float    posz         = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[1], mpos_leftdown.z, mpos_rightup.z);
            int      life         = FreedomAIEncoderAndDecoder.BitBunch2int(mAllBitBunch[2], 1000, 2000);
            float    strong       = FreedomAIEncoderAndDecoder.BitBunch2float(mAllBitBunch[3], 0.0f, 1.0f);

            mPosition.x = posx;
            mPosition.y = mpos_leftdown.y;
            mPosition.z = posz;
            mLife       = life; mTempLife = mLife;
            mStrongRate = strong;
        }