#if UNITY_2017_2_OR_NEWER
//-----------------------------------------------------------------------
//
// Copyright (c) Sirenix IVS. All rights reserved.
//
//-----------------------------------------------------------------------
[assembly: Sirenix.Serialization.RegisterFormatter(typeof(Sirenix.Serialization.Vector2IntFormatter))]
[assembly: Sirenix.Serialization.RegisterFormatter(typeof(Sirenix.Serialization.Vector3IntFormatter))]
namespace Sirenix.Serialization
{
using UnityEngine;
///
/// Custom formatter for the type.
///
///
public class Vector2IntFormatter : MinimalBaseFormatter
{
private static readonly Serializer Serializer = Serialization.Serializer.Get();
///
/// Reads into the specified value using the specified reader.
///
/// The value to read into.
/// The reader to use.
protected override void Read(ref Vector2Int value, IDataReader reader)
{
value.x = Vector2IntFormatter.Serializer.ReadValue(reader);
value.y = Vector2IntFormatter.Serializer.ReadValue(reader);
}
///
/// Writes from the specified value using the specified writer.
///
/// The value to write from.
/// The writer to use.
protected override void Write(ref Vector2Int value, IDataWriter writer)
{
Vector2IntFormatter.Serializer.WriteValue(value.x, writer);
Vector2IntFormatter.Serializer.WriteValue(value.y, writer);
}
}
///
/// Custom formatter for the type.
///
///
public class Vector3IntFormatter : MinimalBaseFormatter
{
private static readonly Serializer Serializer = Serialization.Serializer.Get();
///
/// Reads into the specified value using the specified reader.
///
/// The value to read into.
/// The reader to use.
protected override void Read(ref Vector3Int value, IDataReader reader)
{
value.x = Vector3IntFormatter.Serializer.ReadValue(reader);
value.y = Vector3IntFormatter.Serializer.ReadValue(reader);
value.z = Vector3IntFormatter.Serializer.ReadValue(reader);
}
///
/// Writes from the specified value using the specified writer.
///
/// The value to write from.
/// The writer to use.
protected override void Write(ref Vector3Int value, IDataWriter writer)
{
Vector3IntFormatter.Serializer.WriteValue(value.x, writer);
Vector3IntFormatter.Serializer.WriteValue(value.y, writer);
Vector3IntFormatter.Serializer.WriteValue(value.z, writer);
}
}
}
#endif