Example #1
0
        private object Get(Vector3Int position, string name, TilemapInformationType type, object defaultValue)
        {
            Key key;

            key.name     = name;
            key.position = position;

            try
            {
                var value = m_storage[key];
                if (value.type != type)
                {
                    Debug.LogWarning("No such property exists!");
                    return(defaultValue);
                }
                return(value.data);
            }
            catch (KeyNotFoundException)
            {
                return(defaultValue);
            }
        }
Example #2
0
        private bool Set(Vector3Int position, string name, TilemapInformationType type, object data)
        {
            if (data == null)
            {
                Debug.LogError("Data is null!");
                return(false);
            }

            Key key;

            key.name     = name;
            key.position = position;

            Value value;

            value.type = type;
            value.data = data;

            m_storage[key] = value;

            return(true);
        }