// Update is called once per frame
    void Update()
    {
        if (Loaded == false)
        {
            Loadstuff();
        }

        if (canspawn == true && Libbuilt == true)
        {
            if (ResNodeListZoneOne.Count < ZoneResZoneMax[0])
            {
                ResNodeListZoneOne.Add(Instantiate(ResNodeGameobject, spawnresnode(1), transform.rotation) as GameObject);
                nodeMaker = new ResNodeinfo(0, GameObject.Find("HeroController").GetComponent <ItemLib>().MatGen(1), false, 0);
                ResNodeListZoneOne [ResNodeListZoneOne.Count - 1].gameObject.GetComponent <ResNode> ().Myres = ResNodeinfo.Copyme(nodeMaker);
                ResNodeListZoneOne [ResNodeListZoneOne.Count - 1].gameObject.name = nodeMaker.ResType.Name + " Node";
                ResNodeListZoneOne [ResNodeListZoneOne.Count - 1].gameObject.GetComponent <ResNode> ().myId = currentid;
                currentid += 1;
                //	Debug.Log (nodeMaker.ResType.Density + " " +nodeMaker.ResType.Name);

                //setter.gameObject.name = nodeMaker.ResType.Name + " Node" +setter.gameObject.GetComponent<ResNode>().Myres.ResType.Density+" " +setter.gameObject.GetComponent<ResNode>().Myres.ResType.Quality+" " +setter.gameObject.GetComponent<ResNode>().Myres.AmountLeft+" " +ResNodeListZoneOne.Count;
            }

            if (ResNodeListZoneTwo.Count < ZoneResZoneMax[1])
            {
                ResNodeListZoneTwo.Add(Instantiate(ResNodeGameobject, spawnresnode(2), transform.rotation) as GameObject);
                setter    = ResNodeListZoneTwo [ResNodeListZoneTwo.Count - 1];
                nodeMaker = new ResNodeinfo(0, GameObject.Find("HeroController").GetComponent <ItemLib>().MatGen(1), false, 0);
                setter.gameObject.GetComponent <ResNode> ().Myres = nodeMaker;
                setter.gameObject.name = nodeMaker.ResType.Name + " Node";
                setter.gameObject.GetComponent <ResNode> ().myId = currentid;
                currentid += 1;
            }

            if (ResNodeListZoneThree.Count < ZoneResZoneMax[2])
            {
                ResNodeListZoneThree.Add(Instantiate(ResNodeGameobject, spawnresnode(3), transform.rotation) as GameObject);
                setter    = ResNodeListZoneThree [ResNodeListZoneThree.Count - 1];
                nodeMaker = new ResNodeinfo(0, GameObject.Find("HeroController").GetComponent <ItemLib>().MatGen(1), false, 0);
                setter.gameObject.GetComponent <ResNode> ().Myres = nodeMaker;
                setter.gameObject.name = nodeMaker.ResType.Name + " Node";
                setter.gameObject.GetComponent <ResNode> ().myId = currentid;
                currentid += 1;
            }
            if (ResNodeListZoneFour.Count < ZoneResZoneMax[3])
            {
                ResNodeListZoneFour.Add(Instantiate(ResNodeGameobject, spawnresnode(4), transform.rotation) as GameObject);
                setter    = ResNodeListZoneFour [ResNodeListZoneFour.Count - 1];
                nodeMaker = new ResNodeinfo(0, GameObject.Find("HeroController").GetComponent <ItemLib>().MatGen(1), false, 0);
                setter.gameObject.GetComponent <ResNode> ().Myres = nodeMaker;
                setter.gameObject.name = nodeMaker.ResType.Name + " Node";
                setter.gameObject.GetComponent <ResNode> ().myId = currentid;
                currentid += 1;
            }
            nodeMaker = null;
            setter    = null;
        }
    }
    public static ResNodeinfo Copyme(ResNodeinfo copy)
    {
        ResNodeinfo temp = new ResNodeinfo();

        temp.AmountLeft  = copy.AmountLeft;
        temp.IsMinebuilt = copy.IsMinebuilt;
        temp.MineLevel   = copy.MineLevel;
        temp.ResType     = MatInfo.copyMe(copy.ResType);



        return(temp);
    }