예제 #1
0
        public void Set(string name, object obj)
        {
            var type = obj.GetType();

            if (type == typeof(UnityEngine.Object) || type.IsSubclassOf(typeof(UnityEngine.Object)))
            {
                objects.Set(name, obj);
            }
            else if (type == typeof(float))
            {
                floats.Set(name, obj);
            }
            else if (type == typeof(int))
            {
                ints.Set(name, obj);
            }
            else if (type == typeof(string))
            {
                strings.Set(name, obj);
            }
            else if (type == typeof(bool))
            {
                bools.Set(name, obj);
            }
            else if (type.IsSubclassOf(typeof(System.Enum)))
            {
                enums.Set(name, obj);
            }
            else if (type == typeof(Vector3))
            {
                vector3s.Set(name, obj);
            }
            else if (type == typeof(Vector2))
            {
                vector2s.Set(name, obj);
            }
            else if (type == typeof(Vector4))
            {
                vector4s.Set(name, obj);
            }
            else if (type == typeof(Color))
            {
                colors.Set(name, obj);
            }
            else if (type == typeof(LayerMaskMap))
            {
                layerMasks.Set(name, obj);
            }
            else
            {
                throw new NotSupportedException($"Type {type.AssemblyQualifiedName} is not supported.");
            }
        }