using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IO;

namespace HaloPlugins
{
    public class AngleBounds : IMetaNode
    {
        float To = 0, From = 0;
        string Name = "AngleBounds";

        public AngleBounds(string Name)
        {
            this.Name = Name;
        }

        #region MetaNode Members

        public void Read(EndianReader br)
        {
            To = br.ReadSingle();
            From = br.ReadSingle();
        }

        public void Read(EndianReader br, int Magic)
        {
            To = br.ReadSingle();
            From = br.ReadSingle();
        }

        public void Write(EndianWriter bw)
        {
            bw.Write(To);
            bw.Write(From);
        }

        public object GetValue()
        {
            return new object[] { To, From };
        }

        public void SetValue(object Value)
        {
            To = (float)((object[])Value)[0];
            From = (float)((object[])Value)[1];
        }

        public int GetSize()
        {
            return 8;
        }

        public void Compile(EndianWriter bw, int Magic)
        {
            bw.Write(To);
            bw.Write(From);
        }

        public void Decompile(EndianWriter bw, int Magic)
        {
            bw.Write(To);
            bw.Write(From);
        }

        public string GetName()
        {
            return Name;
        }

        #endregion

        #region ICloneable Members

        public object Clone()
        {
            AngleBounds s = new AngleBounds(this.Name);
            s.To = this.To;
            s.From = this.From;
            return s;
        }

        #endregion

        #region ToString

        public override string ToString()
        {
            return "AngleBounds: " + Name + ", To: " + To.ToString() + ", From: " + From.ToString();
        }

        #endregion
    }
}
