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); }
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); }
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); }