/// <summary>
 /// creates a new CoreData
 /// </summary>
 /// <param name="name">Name of Entity</param>
 /// <param name="baseName">BaseName of Entity</param>
 /// <param name="transform">GameOject transform that the entity derives from</param>
 /// <param name="mesh">GameOject mesh that the entity derives from</param>
 public CoreData(ByteString30 name, ByteString30 baseName, Transform transform, Mesh mesh)
 {
     Name     = name;
     BaseName = baseName;
     if (transform != null && mesh != null)
     {
         try
         {
             scale   = transform.localScale;
             size    = mesh.bounds.size;
             isValid = true;
         }
         catch
         {
             Debug.LogWarning("CoreData: Unknown Exception");
             scale   = new float3();
             size    = new float3();
             isValid = false;
         }
     }
     else
     {
         Debug.LogWarning("CoreData: Failed to create CoreData, invalid transform or mesh");
         scale   = new float3();
         size    = new float3();
         isValid = false;
     }
 }
 /// <summary>
 /// Creates a new CoreData
 /// </summary>
 /// <param name="name">name of the Entity</param>
 /// <param name="baseName">base name of the Entity</param>
 /// <param name="go">GameObject (NOT PREFAB) that the Entity comes from</param>
 public CoreData(ByteString30 name, ByteString30 baseName, GameObject go)
 {
     Name     = name;
     BaseName = baseName;
     if (go != null)
     {
         try
         {
             scale   = go.GetComponent <Transform>().localScale;
             size    = go.GetComponent <MeshFilter>().sharedMesh.bounds.size;
             isValid = true;
         }
         catch
         {
             Debug.LogWarning("CoreData: Failed to generate CoreData due to a posibly null GoameObject, Transform, or MeshFilter");
             scale   = new float3();
             size    = new float3();
             isValid = false;
         }
     }
     else
     {
         scale   = new float3();
         size    = new float3();
         isValid = false;
     }
 }
 public EnviromentData(ByteString30 EntityName, int EntityId, int EntityParentId, ByteString30 EnviromentPath)
 {
     entityName     = EntityName;
     entityId       = EntityId;
     entityParentId = EntityParentId;
     pathString     = EnviromentPath;
     isValid        = true;
 }
 public EnviromentData(string EntityName, int EntityId, int EntityParentId, string EnviromentPath)
 {
     entityName     = new ByteString30(EntityName);
     entityId       = EntityId;
     entityParentId = EntityParentId;
     pathString     = new ByteString30(EnviromentPath);
     isValid        = true;
 }
 public CoreData(ByteString30 name, ByteString30 baseName, float3 mSize, float3 mScale)
 {
     Name     = name;
     BaseName = baseName;
     size     = mSize;
     scale    = mScale;
     isValid  = true;
 }
 public bool Equals(ByteString30 bs)
 {
     if (bs.length != length)
     {
         return(false);
     }
     for (int i = 0; i < length; i++)
     {
         if (Get(i) != bs.Get(i))
         {
             return(false);
         }
     }
     return(true);
 }
        /// <summary>
        /// converts a string into a ByteString30
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public static ByteString30 StringToByteString30(string a)
        {
            ByteString30 bs = new ByteString30();

            byte[] bytes = StringToByteA(a);
            //	Debug.LogWarning(a + ":" + a.Length);
            bs.length = a.Length;
            for (int i = 0; i < 30; i++)
            {
                if (i < bytes.Length)
                {
                    //    Debug.Log(a+"["+i+"] = "+bytes[i]+":"+(char)bytes[i]);
                    switch (i)
                    {
                    case 0:
                        bs.A = bytes[i];
                        break;

                    case 1:
                        bs.B = bytes[i];
                        break;

                    case 2:
                        bs.C = bytes[i];
                        break;

                    case 3:
                        bs.D = bytes[i];
                        break;

                    case 4:
                        bs.E = bytes[i];
                        break;

                    case 5:
                        bs.F = bytes[i];
                        break;

                    case 6:
                        bs.G = bytes[i];
                        break;

                    case 7:
                        bs.H = bytes[i];
                        break;

                    case 8:
                        bs.I = bytes[i];
                        break;

                    case 9:
                        bs.J = bytes[i];
                        break;

                    case 10:
                        bs.K = bytes[i];
                        break;

                    case 11:
                        bs.L = bytes[i];
                        break;

                    case 12:
                        bs.M = bytes[i];
                        break;

                    case 13:
                        bs.N = bytes[i];
                        break;

                    case 14:
                        bs.O = bytes[i];
                        break;

                    case 15:
                        bs.P = bytes[i];
                        break;

                    case 16:
                        bs.Q = bytes[i];
                        break;

                    case 17:
                        bs.R = bytes[i];
                        break;

                    case 18:
                        bs.S = bytes[i];
                        break;

                    case 19:
                        bs.T = bytes[i];
                        break;

                    case 20:
                        bs.U = bytes[i];
                        break;

                    case 21:
                        bs.V = bytes[i];
                        break;

                    case 22:
                        bs.W = bytes[i];
                        break;

                    case 23:
                        bs.X = bytes[i];
                        break;

                    case 24:
                        bs.Y = bytes[i];
                        break;

                    case 25:
                        bs.Z = bytes[i];
                        break;

                    case 26:
                        bs.AA = bytes[i];
                        break;

                    case 27:
                        bs.AB = bytes[i];
                        break;

                    case 28:
                        bs.AC = bytes[i];
                        break;

                    case 29:
                        bs.AD = bytes[i];
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
            return(bs);
        }
        /// <summary>
        /// converts a ByteStirng30 into a String
        /// </summary>
        /// <param name="bs"></param>
        /// <returns></returns>
        public static string ByteString30ToString(ByteString30 bs)
        {
            byte[] bytes = new byte[bs.length];
            for (int i = 0; i < bs.length; i++)
            {
                switch (i)
                {
                case 0:
                    bytes[i] = bs.A;
                    break;

                case 1:
                    bytes[i] = bs.B;
                    break;

                case 2:
                    bytes[i] = bs.C;
                    break;

                case 3:
                    bytes[i] = bs.D;
                    break;

                case 4:
                    bytes[i] = bs.E;
                    break;

                case 5:
                    bytes[i] = bs.F;
                    break;

                case 6:
                    bytes[i] = bs.G;
                    break;

                case 7:
                    bytes[i] = bs.H;
                    break;

                case 8:
                    bytes[i] = bs.I;
                    break;

                case 9:
                    bytes[i] = bs.J;
                    break;

                case 10:
                    bytes[i] = bs.K;
                    break;

                case 11:
                    bytes[i] = bs.L;
                    break;

                case 12:
                    bytes[i] = bs.M;
                    break;

                case 13:
                    bytes[i] = bs.N;
                    break;

                case 14:
                    bytes[i] = bs.O;
                    break;

                case 15:
                    bytes[i] = bs.P;
                    break;

                case 16:
                    bytes[i] = bs.Q;
                    break;

                case 17:
                    bytes[i] = bs.R;
                    break;

                case 18:
                    bytes[i] = bs.S;
                    break;

                case 19:
                    bytes[i] = bs.T;
                    break;

                case 20:
                    bytes[i] = bs.U;
                    break;

                case 21:
                    bytes[i] = bs.V;
                    break;

                case 22:
                    bytes[i] = bs.W;
                    break;

                case 23:
                    bytes[i] = bs.X;
                    break;

                case 24:
                    bytes[i] = bs.Y;
                    break;

                case 25:
                    bytes[i] = bs.Z;
                    break;

                case 26:
                    bytes[i] = bs.AA;
                    break;

                case 27:
                    bytes[i] = bs.AB;
                    break;

                case 28:
                    bytes[i] = bs.AC;
                    break;

                case 29:
                    bytes[i] = bs.AD;
                    break;
                }
            }

            /*  byte[] bytes = new byte[]{
             * byteString.A,
             * byteString.B,
             * byteString.C,
             * byteString.D,
             * byteString.E,
             * byteString.F,
             * byteString.G,
             * byteString.H,
             * byteString.I,
             * byteString.J,
             * byteString.K,
             * byteString.L,
             * byteString.M,
             * byteString.N,
             * byteString.O,
             * byteString.P,
             * byteString.Q,
             * byteString.R,
             * byteString.S,
             * byteString.T,
             * byteString.U,
             * byteString.V,
             * byteString.W,
             * byteString.X,
             * byteString.Y,
             * byteString.Z,
             * byteString.AA,
             * byteString.AB,
             * byteString.AC,
             * byteString.AD,
             * };
             */
            return(ByteAToString(bytes));
        }