// Generate By EToy
// Don't Edit It!!

using XGame.Framework.Database;
using XGame.Framework.Serialization;

namespace XGame.Database
{
    /// <summary> Map </summary>
    public sealed class MapTable : ITable
    {
        long ITable.Key => Id;

        /// <summary> 主键 </summary>
        public int Id { get; private set; }

        /// <summary> 地图名字 </summary>
        public string Name { get; private set; }

        /// <summary> 资源名字 </summary>
        public string AssetName { get; private set; } // c

        /// <summary> 玩家出生点 </summary>
        public Vec3 PlayerBirth { get; private set; }

        /// <summary> 战斗地点,使用哪个由Chapter.part决定 </summary>
        public Vec3[] BattlePositions { get; private set; }

        /// <summary> 怪物出生点,一个取中间，2个左右对称偏移 </summary>
        public Vec3[] MonsterPositions { get; private set; }

        void ISerializable.Deserialize(IReader reader)
        {
            Id = reader.ReadInt();
            Name = reader.ReadString();
            AssetName = reader.ReadString();
            PlayerBirth = reader.ReadSerializable<Vec3>();
            BattlePositions = reader.ReadEnumerable<Vec3[]>();
            MonsterPositions = reader.ReadEnumerable<Vec3[]>();
        }

        void ISerializable.Serialize(IWriter writer)
        {
            writer.Write(Id);
            writer.Write(Name);
            writer.Write(AssetName);
            writer.Write(PlayerBirth);
            writer.Write(BattlePositions);
            writer.Write(MonsterPositions);
        }
    }
}
