public void LoadPlayer() { JB_PlayerData data = JB_SaveSystem.LoadPlayer(); OrganiseGroceryList(data); List <bool> leverArray = new List <bool>(); List <bool> waterMoveArray = new List <bool>(); List <bool> waterToggleArray = new List <bool>(); foreach (bool item in data.levers) { leverArray.Add(item); } foreach (bool item in data.waterMovables) { waterMoveArray.Add(item); } foreach (bool item in data.waterToggles) { waterToggleArray.Add(item); } playerUnit.GetComponent <JB_PlayerUnit>().LoadSceneItems(leverArray, waterMoveArray, waterToggleArray); playerUnit.GetComponent <JB_PlayerUnit>().canMove = data.movable; CheckPlayerType(data.heroType); Vector2 position; position.x = data.position[0]; position.y = data.position[1]; playerUnit.transform.position = position; for (int i = 0; i < data.itemsPickedUp.Count; ++i) { playerUnit.GetComponent <JB_PlayerUnit>().itemsPickedUp[i] = data.itemsPickedUp[i]; } }
public void SavePlayer() { // check if to see if player is on pressure pad object before saving playerUnit.GetComponent <JB_PlayerUnit>().SendMessage("FindSceneItems"); JB_SaveSystem.SavePlayer(playerUnit.GetComponent <JB_PlayerUnit>()); }