public void createNewData()
    {
        BinaryFormatter bf = new BinaryFormatter ();
        FileStream file = File.Create (Application.persistentDataPath + "/playerInfo.dat");
        PlayerData data = new PlayerData ();

        data.firstLoad = true;
        data.versionId = currentVersion;
        data.populationCount = 1;
        data.population = new List<serialAgent> ();
        data.buildingDatabase = new List<serialBuilding> ();
        data.settlementWeapons = new List<serialWeapon> ();
        serialWeapon defaultWeapon = new serialWeapon();
        defaultWeapon.weaponId = ""+1000;
        defaultWeapon.weaponName = "Blacktail";
        defaultWeapon.weaponType = "Handgun";
        defaultWeapon.accuracy = 0.85f;
        defaultWeapon.damageModifier = 4;
        defaultWeapon.range = 12;
        defaultWeapon.rangeModifier = 0.1f;
        defaultWeapon.soundRange = 6;
        data.settlementWeapons.Add (defaultWeapon);
        serialWeapon defaultWeapon1 = new serialWeapon();
        defaultWeapon1.weaponId = ""+1001;
        defaultWeapon1.weaponName = "Matilda";
        defaultWeapon1.weaponType = "Handgun";
        defaultWeapon1.accuracy = 0.95f;
        defaultWeapon1.damageModifier = 4;
        defaultWeapon1.range = 12;
        defaultWeapon1.rangeModifier = 0.1f;
        defaultWeapon1.soundRange = 6;
        data.settlementWeapons.Add (defaultWeapon1);
        serialWeapon defaultWeapon2 = new serialWeapon();
        defaultWeapon2.weaponId = ""+1002;
        defaultWeapon2.weaponName = "Striker";
        defaultWeapon2.weaponType = "Shotgun";
        defaultWeapon2.accuracy = 0.95f;
        defaultWeapon2.damageModifier = 6;
        defaultWeapon2.range = 8;
        defaultWeapon2.rangeModifier = 0.2f;
        defaultWeapon2.soundRange = 12;
        data.settlementWeapons.Add (defaultWeapon2);
        serialWeapon defaultWeapon3 = new serialWeapon();
        defaultWeapon3.weaponId = ""+1003;
        defaultWeapon3.weaponName = "Hunting";
        defaultWeapon3.weaponType = "Rifle";
        defaultWeapon3.accuracy = 0.75f;
        defaultWeapon3.damageModifier = 6;
        defaultWeapon3.range = 13;
        defaultWeapon3.rangeModifier = 0.05f;
        defaultWeapon3.soundRange = 13;
        data.settlementWeapons.Add (defaultWeapon3);

        bf.Serialize (file, data);

        dataExists = true;
        file.Close ();
    }
    void results()
    {
        PlayerData myData = PlayerDataManager.playerDataManager.loadSaveData ();
        //updatescrap
        if (win && !rewardTriggered) {
            Debug.Log ("win was called");

            winUI.sprite = winSprite;

            myData.scrap += scrapRate;
            GameObject newSObj = (GameObject) Instantiate ( scrapObj, Vector3.zero, Quaternion.identity );
            newSObj.transform.SetParent ( rewardBucket.transform );
            newSObj.transform.localScale = new Vector3( 1, 1, 1);
            newSObj.GetComponent<Reward_Scrap>().scrapVal.text = ""+scrapRate;

            for (int i = 0; i < recruitRate; i++) {
                serialAgent newAgent = new serialAgent ();
                //Gender
                string[] genderArray = new string[2] {
                    "Male",
                    "Female"
                };
                int randomGender = Random.Range (0, (genderArray.Length));
                newAgent.agentId = "NEWAGENT";
                newAgent.gender = genderArray [randomGender];
                newAgent.agentName = generateNewAgentName (newAgent.gender);
                newAgent.xPos = 0;
                newAgent.yPos = 0;
                newAgent.zPos = 0;

                newAgent.health = 60;
                newAgent.hunger = 80;

                newAgent.strength = randomStat ();
                newAgent.perception = randomStat ();
                newAgent.agility = randomStat ();

                newAgent.state = AgentLogic_07.agentState.Wandering;
                newAgent.job = AgentLogic_07.jobSubState.Default;
                if( newAgent.gender == "Male" ){
                    newAgent.photo = (int) Random.Range (0,settlerObj.GetComponent<Reward_Person>().maleSprites.Count-1);
                    newAgent.myModelIndex = (int) Random.Range (0,6);
                } else {
                    newAgent.photo = (int) Random.Range (0,settlerObj.GetComponent<Reward_Person>().femaleSprites.Count-1);
                    newAgent.myModelIndex = (int) Random.Range (0,11);
                }

                GameObject newWObj = (GameObject) Instantiate ( settlerObj, Vector3.zero, Quaternion.identity );
                newWObj.transform.SetParent ( rewardBucket.transform );
                newWObj.transform.localScale = new Vector3( 1, 1, 1);
                newWObj.GetComponent<Reward_Person>().agentName.text = newAgent.agentName;
                newWObj.GetComponent<Reward_Person>().strVal.text = ""+newAgent.strength;
                newWObj.GetComponent<Reward_Person>().perVal.text = ""+ newAgent.perception;
                newWObj.GetComponent<Reward_Person>().aglVal.text = ""+newAgent.agility;
                if( newAgent.gender == "Male"){
                    newWObj.GetComponent<Reward_Person>().agentImg.sprite = newWObj.GetComponent<Reward_Person>().maleSprites[newAgent.photo];
                } else {
                    newWObj.GetComponent<Reward_Person>().agentImg.sprite = newWObj.GetComponent<Reward_Person>().femaleSprites[newAgent.photo];
                }

                myData.population.Add (newAgent);
                myData.populationCount++;
                Debug.Log ("newAgent: " + newAgent.agentName + " was added");
            }

            for (int i = 0; i < weaponRate; i++) {
                serialWeapon newWeapon = new serialWeapon ();

                string gunName = _nameGenerator.GetAdjective () + " " + _nameGenerator.GetVerbs ();
                gunName = gunName.ToUpper ();

                newWeapon.weaponName = gunName;
                newWeapon.weaponId = "" + ((int)Random.Range (1000, 9999));
                int dice = (int)rollDice (1, 7);

                if (dice <= 3) {
                    newWeapon.weaponType = "Handgun";
                    newWeapon.range = 8 + (int)rollDice (-2, 2);
                    newWeapon.accuracy = 0.95f + rollDice (-0.3f, 0.3f);
                    newWeapon.damageModifier = 6 + (int)rollDice (-3, 3);
                    newWeapon.rangeModifier = 0.1f;
                    newWeapon.soundRange = newWeapon.range - 3 + (newWeapon.damageModifier / 2);
                } else if (dice <= 5) {
                    newWeapon.weaponType = "Shotgun";
                    newWeapon.range = 6 + (int)rollDice (-2, 2);
                    newWeapon.accuracy = 0.95f + rollDice (-0.2f, 0.2f);
                    newWeapon.damageModifier = 6 + (int)rollDice (-3, 6);
                    newWeapon.rangeModifier = 0.2f;
                    newWeapon.soundRange = newWeapon.range - 3 + (newWeapon.damageModifier / 2);
                } else {
                    newWeapon.weaponType = "Rifle";
                    newWeapon.range = 13 + (int)rollDice (-3, 3);
                    newWeapon.accuracy = 0.75f + rollDice (-0.2f, 0.2f);
                    newWeapon.damageModifier = 6 + (int)rollDice (-2, 4);
                    newWeapon.rangeModifier = 0.05f;
                    newWeapon.soundRange = newWeapon.range - 3 + (newWeapon.damageModifier / 2);
                }

                GameObject newWObj = (GameObject) Instantiate ( weaponObj, Vector3.zero, Quaternion.identity );
                newWObj.transform.SetParent ( rewardBucket.transform );
                newWObj.transform.localScale = new Vector3( 1, 1, 1);
                newWObj.GetComponent<Reward_Weapon>().weaponName.text = newWeapon.weaponName;
                newWObj.GetComponent<Reward_Weapon>().weaponType.text = "["+newWeapon.weaponType+"]";
                newWObj.GetComponent<Reward_Weapon>().dmgMod.text = "+"+newWeapon.damageModifier;
                newWObj.GetComponent<Reward_Weapon>().rngMod.text = ""+ newWeapon.range;
                newWObj.GetComponent<Reward_Weapon>().accMod.text = newWeapon.accuracy*10 + "%";
                myData.settlementWeapons.Add (newWeapon);

                rewardTriggered = true;

            }
        } else if(!rewardTriggered) {
            winUI.sprite = loseSprite;
            if( winUI.gameObject.GetComponentInChildren<ScrollRect>().gameObject.activeSelf )
                winUI.gameObject.GetComponentInChildren<ScrollRect>().gameObject.SetActive(false);
        }

        foreach (serialAgent sA in myData.currentParty) {
            for( int i = myData.population.Count - 1; i >=0; i--){
                if( sA.agentId == myData.population[i].agentId ){
                    Debug.Log ( myData.population.Count );
                    myData.population.Remove ( myData.population[i] );
                    Debug.Log ( sA.agentName + " was removed " + myData.population[i].agentName  );
                    Debug.Log ( myData.population.Count );
                }
            }
        }
        foreach (Unit fU in _gameController.folk) {
            foreach( serialAgent sA in myData.currentParty ){
                if( sA.agentId == fU.agentId ){
                    sA.health = fU.health * 10;
                }
            }
        }
        foreach (serialAgent sA in myData.currentParty) {
            if( sA.health > 0 ){
                Debug.Log (sA.agentName + "readded to population");
                myData.population.Add ( sA );
            }
        }
        myData.currentParty.Clear ();

        PlayerDataManager.playerDataManager.writePlayerData (myData);
        //loadBuild ();
    }