本文整理汇总了C#中UnityEngine.Transform.GetSiblingIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Transform.GetSiblingIndex方法的具体用法?C# Transform.GetSiblingIndex怎么用?C# Transform.GetSiblingIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Transform
的用法示例。
在下文中一共展示了Transform.GetSiblingIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformWithSlibind
public TransformWithSlibind(Transform t)
{
this.t = t;
slibind = new List<int>();
slibind.Add(t.GetSiblingIndex());
while (t.parent != null)
{
slibind.Insert(0, t.parent.GetSiblingIndex());
t = t.parent;
}
}
示例2: OnPointerDown
public void OnPointerDown(int bottle)
{
if (!nextBtn.isActiveAndEnabled)
{
PlaySoundClick();
startBottleParent = bottleList[bottle].transform.parent;
startBottleParent.GetComponent<GridLayoutGroup>().enabled = false;
onFrontScene.transform.position = bottleList[bottle].transform.parent.position;
bottleList[bottle].transform.SetParent(onFrontScene.transform, false);
silbingPanelIndex = startBottleParent.GetSiblingIndex();
}
}
示例3: Rebase
static public void Rebase(Transform transform, Transform to)
{
var transformSO = new SerializedObject(transform);
var toSO = new SerializedObject(to);
var transformPrefabLink = transformSO.FindProperty("m_PrefabInternal").objectReferenceValue;
var toPrefabLink = toSO.FindProperty("m_PrefabInternal").objectReferenceValue;
toSO.FindProperty("m_PrefabInternal").objectReferenceValue = null;
transformSO.FindProperty("m_PrefabInternal").objectReferenceValue = null;
transformSO.ApplyModifiedProperties();
toSO.ApplyModifiedProperties();
var index = transform.GetSiblingIndex();
var lp = transform.localPosition;
var lr = transform.localRotation;
var ls = transform.localScale;
transform.parent = to;
transform.localPosition = lp;
transform.localRotation = lr;
transform.localScale = ls;
transform.SetSiblingIndex(index);
transformSO.Update();
toSO.Update();
transformSO.FindProperty("m_PrefabInternal").objectReferenceValue = transformPrefabLink;
toSO.FindProperty("m_PrefabInternal").objectReferenceValue = toPrefabLink;
transformSO.ApplyModifiedProperties();
toSO.ApplyModifiedProperties();
}
示例4: Update
//.........这里部分代码省略.........
Vector3 currentOffset;
float currentY = selectedArtistContainer.position.y;
if (!waitingForAlbumSelection) {
foreach (Transform album in selectedArtistContainer) {
currentOffset = new Vector3(folderEndPositions[0].x * -0.2f, 0, folderEndPositions[0].z * -0.2f);
albumEndPositions[albumIndex] = (new Vector3(folderEndPositions[0].x * 0.8f, currentY, folderEndPositions[0].z * 0.8f) - currentOffset*(currentY/-0.5f));
positionAlbum(album.gameObject, albumEndPositions[albumIndex]);
albumIndex++;
currentY -= 0.1f;
}
}
}
if (Input.GetKeyDown("x")) {
folderIsMoving = true;
artistSelected = false;
waitingForAlbumSelection = false;
//Move albums back, deactivate
foreach (Transform album in selectedArtistContainer) {
album.gameObject.SetActive(false);
}
albumsOut = false;
foldersLifted = false;
}
if (Input.GetKeyDown("w")) {
waitingForAlbumSelection = true;
if (selectedAlbumIndex > 0) {
selectedAlbum.GetChild(0).gameObject.SetActive(false);
selectedAlbumIndex--;
//Move albums down
albumLiftingDown = true;
previouslySelectedAlbum = selectedAlbum;
previouslySelectedAlbumIndex = previouslySelectedAlbum.GetSiblingIndex();
scrollTarget = selectedAlbum.parent.GetChild(previouslySelectedAlbumIndex-1).localPosition + new Vector3(0, -3, 0);
}
}
if (Input.GetKeyDown("s")) {
waitingForAlbumSelection = true;
if (selectedAlbumIndex < selectedArtistContainer.childCount-1) {
selectedAlbum.GetChild(0).gameObject.SetActive(false);
selectedAlbumIndex++;
//Move albums up
albumLiftingUp = true;
previouslySelectedAlbum = selectedAlbum;
previouslySelectedAlbumIndex = previouslySelectedAlbum.GetSiblingIndex();
scrollTarget = selectedAlbum.parent.GetChild(previouslySelectedAlbumIndex+1).localPosition + new Vector3(0, 3, 0);
}
}
if (Input.GetKeyDown("f") && albumsOut && !albumSelected) {
albumSelected = true;
}
selectedAlbum = selectedArtistContainer.transform.GetChild(selectedAlbumIndex);
if (albumLiftingUp) {
liftAlbumUp(previouslySelectedAlbum.gameObject, scrollTarget);
}
if (albumLiftingDown) {
liftAlbumDown(selectedAlbum.gameObject, albumEndPositions[selectedAlbumIndex]);
}
}
} catch (UnityException) {
}
示例5: CreateLayoutElement
public void CreateLayoutElement(Transform element) {
EditorApplication.delayCall += () => {
EditorApplication.delayCall = null;
FlowDatabase.AddLayoutElementComponent("LayoutElement", element.parent, element.GetSiblingIndex());
};
}