/// <summary> /// Sets the transform's rotation on the given axis. /// </summary> static public void SetRotation(this Transform inTransform, Vector3 inRotation, Axis inAxis = Axis.XYZ, Space inSpace = Space.World) { if (inAxis != 0) { Vector3 rotation; if (inAxis == Axis.XYZ) { rotation = inRotation; } else { EulerStorage record = EulerStorage.GetRecord(inTransform); if (record != null) { rotation = record.Get(inSpace); VectorUtil.CopyFrom(ref rotation, inRotation, inAxis); record.Set(inSpace, rotation); } else { rotation = (inSpace == Space.Self ? inTransform.localEulerAngles : inTransform.eulerAngles); VectorUtil.CopyFrom(ref rotation, inRotation, inAxis); } } if (inSpace == Space.Self) { inTransform.localEulerAngles = rotation; } else { inTransform.localEulerAngles = rotation; } } }
public void OnTweenEnd() { if ((m_Properties & TransformProperties.Rotation) != 0) { EulerStorage.RemoveTransform(m_RecordID); } }
public void OnTweenStart() { m_Start = new TransformState(m_Transform, m_End.Space); if ((m_Properties & TransformProperties.Rotation) != 0) { EulerStorage.AddTransform(m_Transform); m_RecordID = m_Transform.GetInstanceID(); } }
private Vector3 GetRotation(Transform inTransform) { EulerStorage record = EulerStorage.GetRecord(inTransform); if (record != null) { return(record.Get(m_Space)); } return(m_Space == UnityEngine.Space.Self ? inTransform.localEulerAngles : inTransform.eulerAngles); }
private Vector3 GetRotation(RectTransform inTransform) { EulerStorage record = EulerStorage.GetRecord(inTransform); if (record != null) { return(record.Get(Space.Self)); } return(inTransform.localEulerAngles); }
public void OnTweenStart() { m_Record = EulerStorage.AddTransform(m_Transform); m_RecordID = m_Transform.GetInstanceID(); m_Start = m_Record.Get(m_Space); m_Delta = m_Target - m_Start; if (m_Mode != AngleMode.Absolute) { WrapEuler(ref m_Delta); } }
public void OnTweenEnd() { EulerStorage.RemoveTransform(m_RecordID); }