public static BuildingAnimationPiece[] GetPiecesForAnimation(Building.Building_Type type, Transform parentTransform) { List <BuildingAnimationPiece> pieces = new List <BuildingAnimationPiece>(); if (type == Building.Building_Type.House) { for (int x = 0; x < parentTransform.childCount; x++) { for (int y = 0; y < parentTransform.GetChild(x).childCount; y++) { Transform pieceTransform = parentTransform.GetChild(x).GetChild(y); BuildingAnimationPiece piece = new BuildingAnimationPiece(pieceTransform, pieceTransform.position, pieceTransform.rotation, new Vector3(0, 0, 0)); pieces.Add(piece); } } } return(pieces.ToArray()); }
public BuildingAnimation(Building.Building_Type type, Transform parentTransform) { this.parentTransform = parentTransform; this.buildingType = type; pieces = BuildingAnimationPiece.GetPiecesForAnimation(type, parentTransform); }