Esempio n. 1
0
 public static Vector2Int Clamp(Vector2Int value, Vector2Int min, Vector2Int max)
 {
     if (min.x > max.x || min.y > max.y)
     {
         InternalDebug.LogError("min value is larger then max value!");
     }
     value.x = Mathf.Clamp(value.x, min.x, max.x);
     value.y = Mathf.Clamp(value.y, min.y, max.y);
     return(value);
 }
    public static string LoadJsonData(string _fileName)
    {
        string _path = Path.Combine(path, _fileName);

        if (!File.Exists(_path))
        {
            InternalDebug.LogError("File not found at: " + _path);
            return(null);
        }

        return(File.ReadAllText(_path));
    }
    public static T FromBinary <T>(string _roomName)
    {
        string _path = Path.Combine(path, _roomName);

        if (File.Exists(_path))
        {
            BinaryFormatter formatter = new BinaryFormatter();

            using FileStream stream = new FileStream(_path, FileMode.Open);
            T _data = (T)formatter.Deserialize(stream);
            return(_data);
        }
        else
        {
            InternalDebug.LogError("File not found in: " + _path);
            return(default);