VR模拟枪支打靶,消灭鬼怪,换弹以及上弦等等硬核枪支操作。 使用HTCVive设备,开启SteamVR进行游玩。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

54 lines
1.1 KiB

using System.Collections;
using UnityEngine;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
[System.Serializable]
public class SaveData {
public string Key {get;set;}
public string Value {get;set;}
public SaveData(){}
public SaveData(string key, string value)
{
this.Key = key;
this.Value = value;
}
}
[System.Serializable]
public class DataState {
public List<SaveData> items = new List<SaveData>();
public DataState(){}
public void AddItem(SaveData item)
{
items.Add(item);
}
}
public class SerializatorBinary {
public static void SaveBinary(DataState state, string dataPath)
{
BinaryFormatter binary = new BinaryFormatter();
FileStream stream = new FileStream(dataPath, FileMode.Create);
binary.Serialize(stream, state);
stream.Close();
}
public static DataState LoadBinary(string dataPath)
{
BinaryFormatter binary = new BinaryFormatter();
FileStream stream = new FileStream(dataPath, FileMode.Open);
DataState state = (DataState)binary.Deserialize(stream);
stream.Close();
return state;
}
}