void RotateCards(bool bActive = true) { if (bActive) { int X_Length = 8, Y_Length = 6; Min_x = Random.Range(0, Cards.GetLength(0) - X_Length); Min_y = Random.Range(0, Cards.GetLength(1) - Y_Length); Max_x = Min_x + X_Length; Max_y = Min_y + Y_Length; } for (int i = Min_x; i < Max_x; i++) { for (int j = Min_y; j < Max_y; j++) { CardController_V3 card = Cards[i, j]; if (bActive) { card.RotateInterval = 0.1f; } else { card.RotateInterval = Random.Range(2f, 5f); } } } }
CardController_V3 CreateCard_C(float _RotateInterval, Vector3 _pos, float scale = 0.3f) { GameObject Card = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Card"), this.transform); Card.transform.localPosition = _pos; Card.transform.localScale = new Vector3(scale, scale, scale); CardController_V3 CardController = Card.AddComponent <CardController_V3>(); CardController.RotateInterval = _RotateInterval; return(CardController); }
CardController_V3[,] Question_9() { CardController_V3[,] Cards = new CardController_V3[40, 15]; for (int i = 0; i < Cards.GetLength(0); i++) { for (int j = 0; j < Cards.GetLength(1); j++) { Cards[i, j] = CreateCard_C(Random.Range(2f, 5f), new Vector3(-90 + i * 4, 20 - j * 6, 0)); } } return(Cards); }