public void SavePlayer() { MainPlayerStatus mainPlayerStatus = player.GetComponent <MainPlayerStatus>(); PlayerMovement playerPosition = player.GetComponent <PlayerMovement>(); SaveSystem.SavePlayer(mainPlayerStatus, playerPosition); }
public static void SavePlayer(MainPlayerStatus mainPlayerStatus, PlayerMovement playerMovement) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/player.continue"; FileStream stream = new FileStream(path, FileMode.Create); MainPlayerData data = new MainPlayerData(mainPlayerStatus, playerMovement); formatter.Serialize(stream, data); stream.Close(); }
void Start() { battleStatus = BattleStatus.NO_BATTLE; Debug.Log("battle start"); mainRpgcontroller = mainRpgcontrol.GetComponent <MainRpgController>(); mainPlayerStatus = player.GetComponent <MainPlayerStatus>(); batleText = battleTextHolder.GetComponent <Text>(); enemy1Status = enemy1.GetComponent <EnemyStatus>(); enemy2Status = enemy2.GetComponent <EnemyStatus>(); enemy3Status = enemy3.GetComponent <EnemyStatus>(); }
public void LoadPlayer() { MainPlayerData data = SaveSystem.LoadPlayer(); // MainPlayerStatus player = new MainPlayerStatus(); // PlayerMovement playerPosition = new PlayerMovement(); MainPlayerStatus mainPlayerStatus = player.GetComponent <MainPlayerStatus>(); PlayerMovement playerPosition = player.GetComponent <PlayerMovement>(); mainPlayerStatus.playerName = data.playerName; mainPlayerStatus.playerLevel = data.playerLevel; mainPlayerStatus.playerExperience = data.playerExperience; mainPlayerStatus.playerGold = data.playerGold; playerPosition.playerStepsLimit = data.playerStepsLimit; mainPlayerStatus.playerMaxHp = data.playerMaxHp; mainPlayerStatus.playerCurrentHp = data.playerCurrentHp; mainPlayerStatus.playerMaxMp = data.playerMaxMp; mainPlayerStatus.playerCurrentMp = data.playerCurrentMp; mainPlayerStatus.playerPhysicalDefense = data.playerPhysicalDefense; mainPlayerStatus.playerMagicalDefense = data.playerMagicalDefense; mainPlayerStatus.playerPhysicalAttack = data.playerPhysicalAttack; mainPlayerStatus.playerMagicalAttack = data.playerMagicalAttack; mainPlayerStatus.playerSpeed = data.playerSpeed; mainPlayerStatus.playerCriticalDamage = data.playerCriticalDamage; mainPlayerStatus.playerCriticalChance = data.playerCriticalChance; mainPlayerStatus.playerArmourHead = data.playerArmourHead; mainPlayerStatus.playerArmourBody = data.playerArmourBody; mainPlayerStatus.playerArmourHand = data.playerArmourHand; mainPlayerStatus.playerArmourFeet = data.playerArmourFeet; mainPlayerStatus.playerNecklace = data.playerNecklace; mainPlayerStatus.playerWristband = data.playerWristband; mainPlayerStatus.playerWeapon = data.playerWeapon; Vector3 position; position.x = data.playerPosition[0]; position.y = data.playerPosition[1]; position.z = data.playerPosition[2]; playerPosition.playerPosition.position = position; }
public MainPlayerData(MainPlayerStatus mainPlayerStatus, PlayerMovement playerMovement) { playerName = mainPlayerStatus.playerName; playerLevel = mainPlayerStatus.playerLevel; playerExperience = mainPlayerStatus.playerExperience; playerGold = mainPlayerStatus.playerGold; playerStepsLimit = playerMovement.playerStepsLimit; playerMaxHp = mainPlayerStatus.playerMaxHp; playerCurrentHp = mainPlayerStatus.playerCurrentHp; playerMaxMp = mainPlayerStatus.playerMaxMp; playerCurrentMp = mainPlayerStatus.playerCurrentMp; playerPhysicalDefense = mainPlayerStatus.playerPhysicalDefense; playerMagicalDefense = mainPlayerStatus.playerMagicalDefense; playerPhysicalAttack = mainPlayerStatus.playerPhysicalAttack; playerMagicalAttack = mainPlayerStatus.playerMagicalAttack; playerSpeed = mainPlayerStatus.playerSpeed; playerCriticalDamage = mainPlayerStatus.playerCriticalDamage; playerCriticalChance = mainPlayerStatus.playerCriticalChance; playerArmourHead = mainPlayerStatus.playerArmourHead; playerArmourBody = mainPlayerStatus.playerArmourBody; playerArmourHand = mainPlayerStatus.playerArmourHand; playerArmourFeet = mainPlayerStatus.playerArmourFeet; playerNecklace = mainPlayerStatus.playerNecklace; playerWristband = mainPlayerStatus.playerWristband; playerWeapon = mainPlayerStatus.playerWeapon; playerPosition = new float[3]; playerPosition[0] = playerMovement.playerPosition.position.x; playerPosition[1] = playerMovement.playerPosition.position.y; playerPosition[2] = playerMovement.playerPosition.position.z; }