Esempio n. 1
0
 protected override void GetTypeStateHeader(ByteArrayWriter writer)
 {
     writer.Write(PrimaryWeapon != null);
     PrimaryWeapon?.GetFullState(writer);
     writer.Write(SecondaryWeapon != null);
     SecondaryWeapon?.GetFullState(writer);
     writer.Write(TertiaryWeapon != null);
     TertiaryWeapon?.GetFullState(writer);
 }
Esempio n. 2
0
 protected override void GetTypeStateHeader(ByteArrayWriter writer)
 {
     //Fast case
     if (InstanceSettings.Count == 0)
     {
         writer.Write((ushort)0);
         return;
     }
     //Otherwise
     //Encode the instance settings dictionary
     writer.Write((ushort)InstanceSettings.Count);
     foreach (var set in InstanceSettings)
     {
         writer.Write(set.Key);
         writer.Write(set.Value);
     }
 }
Esempio n. 3
0
        private void WriteContent(ByteArrayWriter writer, int length)
        {
            writer.ValidateCapacity(length);

            writer.Write(documentHeader);

            if (tuples.Count > 0)
            {
                for (int i = 0; i < tuples.Count; i++)
                {
                    writer.Write(tuples[i].Data);
                }
            }
            else
            {
                writer.Write(defaultTuple0);
                writer.Write(aor);
                writer.Write(defaultTuple1);
            }

            writer.Write(documentFooter);
        }
Esempio n. 4
0
        public void GetFullState(ByteArrayWriter writer)
        {
            writer.Write(ReflectionName);
            writer.Write(GameEnded);
            writer.Write(AllowRespawn);
            writer.Write(RespawnTime);
            writer.Write(WinningTeam.TeamId);
            writer.Write((ushort)Teams.Length);
            foreach (var team in Teams)
            {
                writer.Write(team.TeamId);
                writer.Write(team.TeamColor);
                writer.Write((ushort)team.Players.Length);
                writer.Write(team.TeamName);
                writer.Write(team.Objective);
            }

            GetPrivateStateData(writer);
        }
Esempio n. 5
0
 public void GetFullState(ByteArrayWriter writer)
 {
     if (_isNullWeapon)
     {
         writer.Write(false);
         return;
     }
     else
     {
         writer.Write(true);
         writer.Write((byte)TargetingType);
         writer.Write(MaxDistance);
         writer.Write(GetProjectileString());
         writer.Write(new HalfVector2(ProjectileVelocity));
         writer.Write(new HalfVector2(ProjectileOffset));
         writer.Write((Half)ProjectileRotation);
         writer.Write((Half)ProjectileRotationVelocity);
         writer.Write(MaxActiveProjectileCount);
         writer.Write(FireRotationIsRelativeToTankRotation);
         writer.Write(FireRotationIsRelativeToTankLookDirection);
         writer.Write((Half)AddedRotation);
         writer.Write(TransformPositionAndVelocityByRotation);
         writer.Write(WeaponRechargeTime);
         writer.Write(WeaponName);
         writer.Write(TimeRecharged);
         writer.Write(_projectiles.Select(p => p.ObjectId).Select(BitConverter.GetBytes).SelectMany(a => a).ToArray());
     }
 }