Ejemplo n.º 1
0
 public static void WriteVector2Nullable(this NetworkWriter writer, Vector2?value)
 {
     writer.WriteBool(value.HasValue);
     if (value.HasValue)
     {
         writer.WriteVector2(value.Value);
     }
 }
        public static void WriteCharacter(this NetworkWriter writer, Character character)
        {
            writer.WriteVector2(character.grid_Position);
            writer.WriteVector2(character.future_Position);
            writer.WriteInt16(character.gold_Cost);
            writer.WriteInt16(character.level);
            writer.WriteInt16(character.mana);
            writer.WriteInt16(character.max_Mana);
            writer.WriteInt16(character.base_Mana);
            writer.WriteInt16(character.attack_Damage);
            writer.WriteInt16(character.spell_Power);
            writer.WriteDouble(character.attack_Speed);
            writer.WriteInt16(character.maxHealth);
            writer.WriteInt16(character.armor);
            writer.WriteInt16(character.magic_Resistance);
            writer.WriteInt16(character.range);
            writer.WriteInt16(character.ID);

            writer.WriteDouble(character.attack_Timer);
        }
Ejemplo n.º 3
0
        public static void WriteSprite(this NetworkWriter writer, Sprite sprite)
        {
            // support 'null' textures for [SyncVar]s etc.
            // https://github.com/vis2k/Mirror/issues/3144
            // simply send a 'null' for texture content.
            if (sprite == null)
            {
                writer.WriteTexture2D(null);
                return;
            }

            writer.WriteTexture2D(sprite.texture);
            writer.WriteRect(sprite.rect);
            writer.WriteVector2(sprite.pivot);
        }
Ejemplo n.º 4
0
 public static void WriteSprite(this NetworkWriter writer, Sprite sprite)
 {
     writer.WriteTexture2D(sprite.texture);
     writer.WriteRect(sprite.rect);
     writer.WriteVector2(sprite.pivot);
 }