Ejemplo n.º 1
0
    //private void OnGUI()
    //{
    //    GUI.Label(new Rect(10, 10, 100, 80), "test float: " + testFloat);
    //}

    public void Save()
    {
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        FileStream      dataFile        = File.Create(Application.persistentDataPath + "/TrainOfBotDataFile.dat");

        Data data = new Data();

        data.testFloat               = 0.0f;
        data.storageRoomBoxPos       = StorageRoomBox.FindObjectOfType <Transform>().position;
        data.testCharacterCanRecieve = true;
        data.testCharacterCanGive    = true;

        //ITEMS
        data.bottleOfBoltsTaken          = BottleOfBolts.FindObjectOfType <BottleOfBolts>().taken;
        data.cabinetKeyTaken             = CabinetKey.FindObjectOfType <CabinetKey>().taken;
        data.chefsSpoonTaken             = ChefsSpoon.FindObjectOfType <ChefsSpoon>().taken;
        data.cookedMechanicalDinnerTaken = CookedMechanicalDinner.FindObjectOfType <CookedMechanicalDinner>().taken;
        data.earmuffsTaken = Earmuffs.FindObjectOfType <Earmuffs>().taken;
        data.frozenMechanicalDinnerTaken = FrozenMechanicalDinner.FindObjectOfType <FrozenMechanicalDinner>().taken;
        data.gasCanisterTaken            = GasCanister.FindObjectOfType <GasCanister>().taken;
        data.passengersEyeTaken          = PassengersEye.FindObjectOfType <PassengersEye>().taken;
        data.plungerTaken = Plunger.FindObjectOfType <Plunger>().taken;
        data.rattleTaken  = Rattle.FindObjectOfType <Rattle>().taken;
        data.valveTaken   = Valve.FindObjectOfType <Valve>().taken;

        data.plungerThrown = Plunger.FindObjectOfType <Plunger>().thrown;

        //NPCS
        data.earmuffsGuyCanGive    = EarmuffsGuy.FindObjectOfType <EarmuffsGuy>().canGiveItem;
        data.earmuffsGuyCanRecieve = EarmuffsGuy.FindObjectOfType <EarmuffsGuy>().canRecieveItem;

        data.eyeRobotCanGive    = EyeRobot.FindObjectOfType <EyeRobot>().canGiveItem;
        data.eyeRobotCanRecieve = EyeRobot.FindObjectOfType <EyeRobot>().canRecieveItem;

        data.chefCanGive    = Chef.FindObjectOfType <Chef>().canGiveItem;
        data.chefCanRecieve = Chef.FindObjectOfType <Chef>().canRecieveItem;
        data.chefFrozen     = Chef.FindObjectOfType <Chef>().frozen;

        data.womanRobotCanGive    = WomanRobot.FindObjectOfType <WomanRobot>().canGiveItem;
        data.womanRobotCanRecieve = WomanRobot.FindObjectOfType <WomanRobot>().canRecieveItem;

        data.cabinetCanGive    = Cabinet.FindObjectOfType <Cabinet>().canGiveItem;
        data.cabinetCanRecieve = Cabinet.FindObjectOfType <Cabinet>().canRecieveItem;

        data.toiletcanRecieve = Toilet.FindObjectOfType <Toilet>().canRecieveItem;

        data.hoboThrew = HoboRobot.FindObjectOfType <HoboRobot>().hoboThrew;

        data.nozzleCanRecieve = Nozzle.FindObjectOfType <Nozzle>().canRecieveItem;

        //ROBOT SPECIFIC
        data.robotLeftBathroom = BathroomRobot.FindObjectOfType <BathroomRobot>().leftBathroom;

        //DOG
        data.dogEating   = Dog.FindObjectOfType <Dog>().eating;
        data.dogLocation = Dog.FindObjectOfType <Transform>().position;

        //DOG BOWL
        data.bowlHasFood  = DogBowl.FindObjectOfType <DogBowl>().hasFood;
        data.dinnerActive = DogBowl.FindObjectOfType <DogBowl>().dinnerActive;

        //WORKTABLE
        data.canRecieveChefsSpoon = Worktable.FindObjectOfType <Worktable>().canRecieveChefsSpoon;
        data.canRecieveBottle     = Worktable.FindObjectOfType <Worktable>().canRecieveBottle;
        data.tableCanGiveItem     = Worktable.FindObjectOfType <Worktable>().canGiveItem;

        //STOVE
        data.canRecieveFMD         = Stove.FindObjectOfType <Stove>().canRecieveFMD;
        data.canRecieveGasCanister = Stove.FindObjectOfType <Stove>().canRecieveGasCanister;
        data.stoveCanGiveItem      = Stove.FindObjectOfType <Stove>().canGiveItem;

        //        Data data = new Data
        //        {
        //            testFloat = 0.0f
        //        };

        binaryFormatter.Serialize(dataFile, data);
        dataFile.Close();
    }