Esempio n. 1
0
        public PowerUp DecodePowerupData(byte[] data, out byte id, out PoweredUpData powerUppedData)
        {
            Converter.DecodePowerupData(data, out id, out float radius, out float duration, out float posX, out float posY, out byte type, out byte[] powerUppedDataArray);
            powerUppedData = PoweredUpData.FromByteArray(powerUppedDataArray);
            var obs = new PowerUp(duration, posX, posY, radius * 2f, radius * 2f);

            obs.SetTypeParams((ArenaObjectType)type);
            return(obs);
        }
Esempio n. 2
0
        public void FromByteArrayTest()
        {
            PoweredUpData data = new PoweredUpData();

            byte[] test = new byte[] { 1, 1, 0, 0, 1, 0 };
            data.MakeBallDeadly      = true;
            data.ChangeBallSpeed     = true;
            data.ChangeBallDirection = false;
            data.GivePlayerLife      = false;
            data.ChangePaddleSpeed   = true;
            data.UndoPlayerMove      = false;

            PoweredUpData result = PoweredUpData.FromByteArray(test);

            Assert.IsTrue(
                result.MakeBallDeadly == true && result.ChangeBallSpeed == true &&
                result.ChangeBallDirection == false && result.GivePlayerLife == false &&
                result.ChangePaddleSpeed == true && result.UndoPlayerMove == false
                );
        }
Esempio n. 3
0
 public void DecodePaddlePoweredUpData(byte[] data, out byte paddleId, out byte ballId, out PoweredUpData powerUppedData)
 {
     Converter.DecodePaddlePoweredUpData(data, out paddleId, out ballId, out byte[] powerUppedDataArray);
     powerUppedData = PoweredUpData.FromByteArray(powerUppedDataArray);
 }
Esempio n. 4
0
 public void DecodeBallPoweredUpData(byte[] data, out byte ballId, out byte powerUpId, out PoweredUpData poweredUp)
 {
     Converter.DecodeBallPoweredUpData(data, out ballId, out powerUpId, out byte[] poweredUpArray);
     poweredUp = PoweredUpData.FromByteArray(poweredUpArray);
 }