public void LoadToken4Details() { Player2Schema mPlayer2Token4 = JsonConvert.DeserializeObject <Player2Schema>(File.ReadAllText(Application.persistentDataPath + "/Player2Data4.json")); mBluePlayers[3].mNumberOfStepsMoved = mPlayer2Token4.mNumberOfStepsMoved; mBluePlayers[3].mLastPosition = mPlayer2Token4.mLastPosition; mBluePlayers[3].mPositionMoved = mPlayer2Token4.mPositionMoved; mBluePlayers[3].mFlag = mPlayer2Token4.mFlag; mBluePlayers[3].mPlayerOutIndex = mPlayer2Token4.mPlayerOutIndex; mBluePlayers[3].mTokenPosition = mPlayer2Token4.mTokenPosition; mBluePlayers[3].mNumberOfStepsRemaining = mPlayer2Token4.mNumberOfStepsRemaining; mBluePlayers[3].mIsReadyToMove = mPlayer2Token4.mIsReadyToMove; mBluePlayers[3].mBlueCanMove = mPlayer2Token4.mBlueCanMove; mBluePlayers[3].mAnotherChance = mPlayer2Token4.mAnotherChance; mBluePlayers[3].mTokenMoved = mPlayer2Token4.mTokenMoved; mBluePlayers[3].mBlueTokenMoving = mPlayer2Token4.mBlueTokenMoving; mBluePlayers[3].mTokenOut = mPlayer2Token4.mTokenOut; mBluePlayers[3].mMovePossible = mPlayer2Token4.mMovePossible; mBluePlayers[3].mStartingPosition = mPlayer2Token4.mStartingPosition; mBluePlayers[3].mPlayerFinished = mPlayer2Token4.mPlayerFinished; Vector3 mTokenPosition3; mTokenPosition3.x = mPlayer2Token4.mPosition[0]; mTokenPosition3.y = mPlayer2Token4.mPosition[1]; mTokenPosition3.z = mPlayer2Token4.mPosition[2]; mBluePlayers[3].gameObject.transform.position = mTokenPosition3; Vector3 mTokenScale3; mTokenScale3.x = mPlayer2Token4.mScale[0]; mTokenScale3.y = mPlayer2Token4.mScale[1]; mTokenScale3.z = mPlayer2Token4.mScale[2]; mBluePlayers[3].gameObject.transform.localScale = mTokenScale3; }
public void SaveDetails() { if (gameObject.name == "Player2Token1") { Player2Schema mData1 = new Player2Schema(); 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.mBlueCanMove = mBlueCanMove; mData1.mAnotherChance = mAnotherChance; mData1.mTokenMoved = mTokenMoved; mData1.mBlueTokenMoving = mBlueTokenMoving; 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 + "/Player2Data1.json", mJson1); } if (gameObject.name == "Player2Token2") { Player2Schema mData2 = new Player2Schema(); 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.mBlueCanMove = mBlueCanMove; mData2.mAnotherChance = mAnotherChance; mData2.mTokenMoved = mTokenMoved; mData2.mBlueTokenMoving = mBlueTokenMoving; 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 + "/Player2Data2.json", mJson2); } if (gameObject.name == "Player2Token3") { Player2Schema mData3 = new Player2Schema(); 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.mBlueCanMove = mBlueCanMove; mData3.mAnotherChance = mAnotherChance; mData3.mTokenMoved = mTokenMoved; mData3.mBlueTokenMoving = mBlueTokenMoving; 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 + "/Player2Data3.json", mJson3); } if (gameObject.name == "Player2Token4") { Player2Schema mData4 = new Player2Schema(); 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.mBlueCanMove = mBlueCanMove; mData4.mAnotherChance = mAnotherChance; mData4.mTokenMoved = mTokenMoved; mData4.mBlueTokenMoving = mBlueTokenMoving; 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 + "/Player2Data4.json", mJson4); } }