This repository has been archived on 2024-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
snakeinabox/Assets/SpaceNavigator/Plugins/Settings/Locks.cs
2020-07-09 11:41:01 -07:00

34 lines
No EOL
793 B
C#

using System;
using UnityEngine;
namespace SpaceNavigatorDriver {
[Serializable]
public class Locks {
public bool X, Y, Z, All;
[SerializeField]
private string _name;
// Constructor
public Locks(string name) {
_name = name;
}
// Methods
public void Write() {
string prefix = _name + " lock ";
PlayerPrefs.SetInt(prefix + "X", X ? 1 : 0);
PlayerPrefs.SetInt(prefix + "Y", Y ? 1 : 0);
PlayerPrefs.SetInt(prefix + "Z", Z ? 1 : 0);
PlayerPrefs.SetInt(prefix + "All", All ? 1 : 0);
}
public void Read() {
string prefix = _name + " lock ";
X = PlayerPrefs.GetInt(prefix + "X", 0) == 1;
Y = PlayerPrefs.GetInt(prefix + "Y", 0) == 1;
Z = PlayerPrefs.GetInt(prefix + "Z", 0) == 1;
All = PlayerPrefs.GetInt(prefix + "All", 0) == 1;
}
}
}