using UnityEngine;

public class Nexus {
    // Deprecated class that creates the model of the scene's doors.

    public string source;
    public int id;
    public Vector4 bound;
    public string destiny;
    public Vector3 obj, centerBox, sizeBox;
    public bool openWorld;
    public float height;

    public Nexus(string source, string destiny, Vector4 bound, float height, int id, Vector3 obj, bool open) {
        this.source = source;
        this.destiny = destiny;
        this.bound = bound;
        this.height = height;
        this.id = id;
        this.obj = obj;
        this.openWorld = open;
    }

    public Nexus(string csvline) {
        Debug.Log(csvline);
        string[] data = csvline.Split(' ');
        this.id = int.Parse(data[1]);
        this.source = data[2];
        this.destiny = data[3];
        this.centerBox[0] = float.Parse(data[4], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.centerBox[1] = float.Parse(data[5], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.centerBox[2] = float.Parse(data[6], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.sizeBox[0] = float.Parse(data[7], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.sizeBox[1] = float.Parse(data[8], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.sizeBox[2] = float.Parse(data[9], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        //this.openWorld = (int.Parse(data[10])) == 1 ? true : false;
        //this.obj.x = float.Parse(data[11], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        //this.obj.y = float.Parse(data[12], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        //this.obj.z = float.Parse(data[13], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);

        /*
        Debug.Log(csvline);
        string[] data = csvline.Split ('\t');
        this.source = data[1];
        this.destiny = data[2];
        this.id = int.Parse (data [3]);
        this.bound[0] = float.Parse (data[4], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.bound[1] = float.Parse (data[5], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.height   = float.Parse (data[6], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.bound[2] = float.Parse (data[7], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.bound[3] = float.Parse (data[8], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.openWorld = (int.Parse(data[9])) == 1 ? true : false;
        this.obj[0] = float.Parse(data[10], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.obj[1] = float.Parse(data[11], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
        this.obj[2] = float.Parse(data[12], System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
         */
    }



    public override string ToString()
    {
        //return "Nexus("+this.id+")[Source: " + this.source + ", Destiny: " + this.destiny + ", Bounds: " + this.bound + "]";
        return "Nexus(" + this.id + ")";
    }
}
