本文整理匯總了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;
}