// przesuwa sekcje w prawo public void MoveSectionsToRight() { sections[0].Bounds = new Bounds(sections[2].Bounds.Right, sections[2].Bounds.Right + sections[0].Background.GetSpriteWidth()); Vector3 newPosition = new Vector3(sections[2].Bounds.Right + sections[0].Background.GetSpriteWidth() / 2, sections[2].transform.position.y); sections[0].transform.position = newPosition; TowerSection[] newSections = new TowerSection[sections.Length]; newSections[0] = sections[1]; newSections[1] = sections[2]; newSections[2] = sections[0]; sections = newSections; }
// zamiana sekcji miejscami public void ReplaceSections(int index1, int index2) { TowerSection tempTs = sections[index1]; sections[index1] = sections[index2]; sections[index2] = tempTs; Bounds tempB = sections[index1].Bounds; Vector3 tempPos = sections[index1].transform.position; sections[index1].Bounds = sections[index2].Bounds; sections[index1].transform.position = sections[index2].transform.position; sections[index2].Bounds = tempB; sections[index2].transform.position = tempPos; }