public void LoadToken4Details() { Player3Schema mPlayer3Token4 = JsonConvert.DeserializeObject <Player3Schema>(File.ReadAllText(Application.persistentDataPath + "/Player3Data4.json")); mYellowPlayers[3].mNumberOfStepsMoved = mPlayer3Token4.mNumberOfStepsMoved; mYellowPlayers[3].mLastPosition = mPlayer3Token4.mLastPosition; mYellowPlayers[3].mPositionMoved = mPlayer3Token4.mPositionMoved; mYellowPlayers[3].mFlag = mPlayer3Token4.mFlag; mYellowPlayers[3].mPlayerOutIndex = mPlayer3Token4.mPlayerOutIndex; mYellowPlayers[3].mTokenPosition = mPlayer3Token4.mTokenPosition; mYellowPlayers[3].mNumberOfStepsRemaining = mPlayer3Token4.mNumberOfStepsRemaining; mYellowPlayers[3].mIsReadyToMove = mPlayer3Token4.mIsReadyToMove; mYellowPlayers[3].mYellowCanMove = mPlayer3Token4.mYellowCanMove; mYellowPlayers[3].mAnotherChance = mPlayer3Token4.mAnotherChance; mYellowPlayers[3].mTokenMoved = mPlayer3Token4.mTokenMoved; mYellowPlayers[3].mYellowTokenMoving = mPlayer3Token4.mYellowTokenMoving; mYellowPlayers[3].mTokenOut = mPlayer3Token4.mTokenOut; mYellowPlayers[3].mMovePossible = mPlayer3Token4.mMovePossible; mYellowPlayers[3].mStartingPosition = mPlayer3Token4.mStartingPosition; mYellowPlayers[3].mPlayerFinished = mPlayer3Token4.mPlayerFinished; Vector3 mTokenPosition3; mTokenPosition3.x = mPlayer3Token4.mPosition[0]; mTokenPosition3.y = mPlayer3Token4.mPosition[1]; mTokenPosition3.z = mPlayer3Token4.mPosition[2]; mYellowPlayers[3].gameObject.transform.position = mTokenPosition3; Vector3 mTokenScale3; mTokenScale3.x = mPlayer3Token4.mScale[0]; mTokenScale3.y = mPlayer3Token4.mScale[1]; mTokenScale3.z = mPlayer3Token4.mScale[2]; mYellowPlayers[3].gameObject.transform.localScale = mTokenScale3; }
public void SaveDetails() { if (gameObject.name == "Player3Token1") { Player3Schema mData1 = new Player3Schema(); mData1.mNumberOfStepsMoved = mNumberOfStepsMoved; mData1.mLastPosition = mLastPosition; mData1.mPositionMoved = mPositionMoved; mData1.mFlag = mFlag; mData1.mPlayerOutIndex = mPlayerOutIndex; mData1.mTokenPosition = mTokenPosition; mData1.mNumberOfStepsRemaining = mNumberOfStepsRemaining; mData1.mIsReadyToMove = mIsReadyToMove; mData1.mYellowCanMove = mYellowCanMove; mData1.mAnotherChance = mAnotherChance; mData1.mTokenMoved = mTokenMoved; mData1.mYellowTokenMoving = mYellowTokenMoving; mData1.mTokenOut = mTokenOut; mData1.mMovePossible = mMovePossible; mData1.mStartingPosition = mStartingPosition; mData1.mPlayerFinished = mPlayerFinished; mData1.mPosition[0] = transform.position.x; mData1.mPosition[1] = transform.position.y; mData1.mPosition[2] = transform.position.z; mData1.mScale[0] = transform.localScale.x; mData1.mScale[1] = transform.localScale.y; mData1.mScale[2] = transform.localScale.z; string mJson1 = JsonConvert.SerializeObject(mData1, Formatting.Indented); File.WriteAllText(Application.persistentDataPath + "/Player3Data1.json", mJson1); } if (gameObject.name == "Player3Token2") { Player3Schema mData2 = new Player3Schema(); mData2.mNumberOfStepsMoved = mNumberOfStepsMoved; mData2.mLastPosition = mLastPosition; mData2.mPositionMoved = mPositionMoved; mData2.mFlag = mFlag; mData2.mPlayerOutIndex = mPlayerOutIndex; mData2.mTokenPosition = mTokenPosition; mData2.mNumberOfStepsRemaining = mNumberOfStepsRemaining; mData2.mIsReadyToMove = mIsReadyToMove; mData2.mYellowCanMove = mYellowCanMove; mData2.mAnotherChance = mAnotherChance; mData2.mTokenMoved = mTokenMoved; mData2.mYellowTokenMoving = mYellowTokenMoving; mData2.mTokenOut = mTokenOut; mData2.mMovePossible = mMovePossible; mData2.mStartingPosition = mStartingPosition; mData2.mPlayerFinished = mPlayerFinished; mData2.mPosition[0] = transform.position.x; mData2.mPosition[1] = transform.position.y; mData2.mPosition[2] = transform.position.z; mData2.mScale[0] = transform.localScale.x; mData2.mScale[1] = transform.localScale.y; mData2.mScale[2] = transform.localScale.z; string mJson2 = JsonConvert.SerializeObject(mData2, Formatting.Indented); File.WriteAllText(Application.persistentDataPath + "/Player3Data2.json", mJson2); } if (gameObject.name == "Player3Token3") { Player3Schema mData3 = new Player3Schema(); mData3.mNumberOfStepsMoved = mNumberOfStepsMoved; mData3.mLastPosition = mLastPosition; mData3.mPositionMoved = mPositionMoved; mData3.mFlag = mFlag; mData3.mPlayerOutIndex = mPlayerOutIndex; mData3.mTokenPosition = mTokenPosition; mData3.mNumberOfStepsRemaining = mNumberOfStepsRemaining; mData3.mIsReadyToMove = mIsReadyToMove; mData3.mYellowCanMove = mYellowCanMove; mData3.mAnotherChance = mAnotherChance; mData3.mTokenMoved = mTokenMoved; mData3.mYellowTokenMoving = mYellowTokenMoving; mData3.mTokenOut = mTokenOut; mData3.mMovePossible = mMovePossible; mData3.mStartingPosition = mStartingPosition; mData3.mPlayerFinished = mPlayerFinished; mData3.mPosition[0] = transform.position.x; mData3.mPosition[1] = transform.position.y; mData3.mPosition[2] = transform.position.z; mData3.mScale[0] = transform.localScale.x; mData3.mScale[1] = transform.localScale.y; mData3.mScale[2] = transform.localScale.z; string mJson3 = JsonConvert.SerializeObject(mData3, Formatting.Indented); File.WriteAllText(Application.persistentDataPath + "/Player3Data3.json", mJson3); } if (gameObject.name == "Player3Token4") { Player3Schema mData4 = new Player3Schema(); mData4.mNumberOfStepsMoved = mNumberOfStepsMoved; mData4.mLastPosition = mLastPosition; mData4.mPositionMoved = mPositionMoved; mData4.mFlag = mFlag; mData4.mPlayerOutIndex = mPlayerOutIndex; mData4.mTokenPosition = mTokenPosition; mData4.mNumberOfStepsRemaining = mNumberOfStepsRemaining; mData4.mIsReadyToMove = mIsReadyToMove; mData4.mYellowCanMove = mYellowCanMove; mData4.mAnotherChance = mAnotherChance; mData4.mTokenMoved = mTokenMoved; mData4.mYellowTokenMoving = mYellowTokenMoving; mData4.mTokenOut = mTokenOut; mData4.mMovePossible = mMovePossible; mData4.mStartingPosition = mStartingPosition; mData4.mPlayerFinished = mPlayerFinished; mData4.mPosition[0] = transform.position.x; mData4.mPosition[1] = transform.position.y; mData4.mPosition[2] = transform.position.z; mData4.mScale[0] = transform.localScale.x; mData4.mScale[1] = transform.localScale.y; mData4.mScale[2] = transform.localScale.z; string mJson4 = JsonConvert.SerializeObject(mData4, Formatting.Indented); File.WriteAllText(Application.persistentDataPath + "/Player3Data4.json", mJson4); } }