Newer
Older
HardPoint-Project-Abertay-University-Unity3D / Assets / Scripts / Systems / SaveSystem / PlayerStatus.cs
@Rackday Rackday on 18 Aug 794 bytes Project Added
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public static class PlayerStatus
{
    public static int hp;
    public static float speedGround;
    public static float speedAir;
    public static int currency;


    public static string TurnIntoJson()
    {
        PlayerInfoStruct temp = new PlayerInfoStruct();
        temp.hp = hp;
        temp.speedGround = speedGround;
        temp.speedAir = speedAir;
        temp.currency = currency;
        return JsonUtility.ToJson(temp, true); ;
    }

    public static void ChangeFromJson(PlayerInfoStruct json)
    {
        hp = json.hp;
        speedGround = json.speedGround;
        currency= json.currency;
        speedAir = json.speedAir;
        currency = json.currency;
    }
}