当前位置: 首页>>代码示例>>C#>>正文


C# Quaternion.FromVector4方法代码示例

本文整理汇总了C#中UnityEngine.Quaternion.FromVector4方法的典型用法代码示例。如果您正苦于以下问题:C# Quaternion.FromVector4方法的具体用法?C# Quaternion.FromVector4怎么用?C# Quaternion.FromVector4使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Quaternion的用法示例。


在下文中一共展示了Quaternion.FromVector4方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExposeProperty


//.........这里部分代码省略.........
                    }
                    break;
                case SerializedPropertyType.Vector4:
                    {
                        var getter = me.target.GetPropertyGetter<object, Vector4>(info);
                        Vector4 val = EditorGUILayout.Vector4Field(name, getter());
                        if (info.CanWrite)
                        {
                            var setter = me.target.GetPropertySetter<object, Vector4>(info);
                            setter(val);
                        }
                    }
                    break;
                //case SerializedPropertyType.ArraySize:
                //{
                //    //Will work out later. Will need to be recursive most likely.
                //    //var getter = me.target.GetPropertyGetter<object, Vector4>(info);
                //    //Vector4 val = EditorGUILayout.(name, getter());
                //    //if (info.CanWrite)
                //    //{
                //    //    var setter = me.target.GetPropertySetter<object, Vector4>(info);
                //    //    setter(val);
                //    //}
                //}
                //break;
                case SerializedPropertyType.AnimationCurve:
                    {
                        var getter = me.target.GetPropertyGetter<object, AnimationCurve>(info);
                        AnimationCurve val = EditorGUILayout.CurveField(name, getter());
                        if (info.CanWrite)
                        {
                            var setter = me.target.GetPropertySetter<object, AnimationCurve>(info);
                            setter(val);
                        }
                    }
                    break;
                case SerializedPropertyType.Bounds:
                    {
                        var getter = me.target.GetPropertyGetter<object, Bounds>(info);
                        Bounds val = EditorGUILayout.BoundsField(name, getter());
                        if (info.CanWrite)
                        {
                            var setter = me.target.GetPropertySetter<object, Bounds>(info);
                            setter(val);
                        }
                    }
                    break;
                //case SerializedPropertyType.Gradient:
                //{
                //    //Will work out later
                //    //var getter = me.target.GetPropertyGetter<object, Gradient>(info);
                //    //Gradient val = EditorGUILayout.(name, getter());
                //    //if (info.CanWrite)
                //    //{
                //    //    var setter = me.target.GetPropertySetter<object, Gradient>(info);
                //    //    setter(val);
                //    //}
                //}
                //break;
                case SerializedPropertyType.Quaternion:
                    {
                        var getter = me.target.GetPropertyGetter<object, Quaternion>(info);
                        Quaternion val = new Quaternion();
                        val.FromVector4(EditorGUILayout.Vector4Field(name, getter().ToVector4()));
                        if (info.CanWrite)
                        {
                            var setter = me.target.GetPropertySetter<object, Quaternion>(info);
                            setter(val);
                        }
                    }
                    break;
                //The draw function for the type must be exposed using the ExposeDrawFunction attribute.
                case SerializedPropertyType.Generic:
                default:
                    {
                        var propType = info.PropertyType;
                        if (TypeDrawFunctions.ContainsKey(propType))
                        {
                            var rect = EditorGUILayout.GetControlRect();
                            var val = info.GetGetMethod().Invoke(me.target, EmptyObjectArray);
                            var contentName = new GUIContent();
                            contentName.text = name;
                            val = TypeDrawFunctions[propType](rect, val, contentName, info);
                            if (info.CanWrite)
                            {
                                if(!propType.IsValueType)
                                {
                                    info.SetValue(me.target, val, EmptyObjectArray);
                                }
                                else
                                {
                                    info.SetValue(me.target, ((ReferenceType)val).GetValue(), EmptyObjectArray);
                                }
                            }
                        }
                    }
                    break;
            }
            GUI.enabled = true;
        }
开发者ID:Filiecs,项目名称:U-EAT,代码行数:101,代码来源:CustomInspectorScripts.cs


注:本文中的UnityEngine.Quaternion.FromVector4方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。