unity源码解析Transform
Transform这个类继承⾃Component, IEnumerable。我们在开发的过程中之所以可以对Transform进⾏foreach,就是因为它实现了IEnumerable抽象⽅法GetEnumerator,该⽅法返回⼀个IEnumerator,⽽通过重写了IEnumerator中的Current,可以依次获得⼦对象。废话不多说了
using System;
using System.Collections;
using System.Runtime.CompilerServices;
using UnityEngine.Internal;
namespace UnityEngine
{
public class Transform : Component, IEnumerable
{
private aled class Enumerator : IEnumerator
{
private Transform outer;
private int currentIndex = -1;
public object Current
{
get
{
this.currentIndex);
return this
this.outer.GetChild(this
}
}
internal Enumerator(Transform outer)
{
this.outer = outer;
this
}
public bool MoveNext()
{
int childCount =this
this.outer.childCount;
this.currentIndex < childCount;
return ++this
}
public void Ret()
{
this
this.currentIndex = -1;
}
}
public Vector3 position
{
get
{
Vector3 result;
this.INTERNAL_get_position(out result);
this
return result;
}
t
{
value);
this
this.INTERNAL_t_position(ref value
this this.INTERNAL_t_position (ref value
value); }
}
public Vector3 localPosition
{
get
{
Vector3 result;
this this.INTERNAL_get_localPosition (out result);
return result;
}
t
{
this this.INTERNAL_t_localPosition (ref value
value); }
}
public Vector3 eulerAngles
{
get
{
return ation.eulerAngles;
}
t
{
ation = Quaternion.Euler (value value);
}
}
public Vector3 localEulerAngles
{
get
{hooters
Vector3 result;
this this.INTERNAL_get_localEulerAngles (out result);
return result;
}
t
{
this this.INTERNAL_t_localEulerAngles (ref value
value); }
}
public Vector3 right
{
get
{
return ation * Vector3.right;
}
t
{
ation = Quaternion.FromToRotation (Vector3.right,value value);
}
}
public Vector3 up
{
get
{
return this
}
t
{
value); this
}
}
public Vector3 forward
{
get
{
return this
}
t
{
value);
this
}
}
swlpublic Quaternion rotation
{
get
{
Quaternion result;
this.INTERNAL_get_rotation(out result);
this
return result;
}
t
{
value);
this
this.INTERNAL_t_rotation(ref value
}
}
public Quaternion localRotation
{
get
{
Quaternion result;
this.INTERNAL_get_localRotation(out result);
this
return result;
}
t
{
value);
this
this.INTERNAL_t_localRotation(ref value
}
}
public Vector3 localScale
{
get
get
马如游龙{
Vector3 result;
this
this.INTERNAL_get_localScale(out result);
return result;
}
t
{
value);
this.INTERNAL_t_localScale(ref value
this
}
}
public Transform parent
{
get
{
this.parentInternal;
return this
}
t
{
if (this
this is RectTransform)
{
Debug.LogWarning("Parent of RectTransform is being t with parent property. Consider using the SetParent method instead, with the worldPositionStays argument t to fal. This will retain local orientation and scale rather than
this);
world orientation and scale, which can prevent common UI scaling issues.",this
}
value;
this.parentInternal = value
this
}
}
internal extern Transform parentInternal
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
3260t;
}
public Matrix4x4 worldToLocalMatrix
{
get
{
Matrix4x4 result;
this.INTERNAL_get_worldToLocalMatrix(out result);
related
this
return result;
土耳其语在线翻译
}
}
public Matrix4x4 localToWorldMatrix
{
get
{
Matrix4x4 result;
this.INTERNAL_get_localToWorldMatrix(out result);
this
this.INTERNAL_get_localToWorldMatrix(out result);
this
return result;
}
}
public extern Transform root
{
[WrapperlessIcall]
fd是什么意思[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern int childCount
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public Vector3 lossyScale
{
get
{
Vector3 result;
ava是什么意思
this
this.INTERNAL_get_lossyScale(out result);
return result;
用发展的眼光看中国}
}
public extern bool hasChanged
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
t;
}
protected Transform()
{
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
value);
private extern void INTERNAL_get_position(out Vector3value
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
value);
private extern void INTERNAL_t_position(ref Vector3valuepep小学英语四年级下册教案
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
value);
private extern void INTERNAL_get_localPosition(out Vector3value [WrapperlessIcall]