Advertisement
Guest User

Shapes

a guest
Feb 25th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GameManager : MonoBehaviour
  6. {
  7. public bool GameOver;
  8. //Populate this list...
  9. public List<Shape> CurrentShapeList = new List<Shape>();
  10. public GameObject[] Prefabs;
  11. public Color[] colors;
  12. void ConvertPrefabsToShapes()
  13. {
  14. foreach(GameObject Prefab in Prefabs)
  15. {
  16.  
  17. Shape newShape = new Shape();
  18. newShape.CreateShape(
  19. Prefab.gameObject,
  20. Prefab.GetComponentsInChildren<SpriteRenderer>(),
  21. new Vector2(1000,1000),
  22. Prefab.transform.rotation
  23. );
  24. CurrentShapeList.Add(newShape);
  25. }
  26. }
  27.  
  28. private void Awake() {
  29. ConvertPrefabsToShapes();
  30. RandomiseShapeColours();
  31. }
  32.  
  33. void RandomiseShapeColours()
  34. {
  35.  
  36. foreach(Shape shape in CurrentShapeList)
  37. {
  38. shape.SetShapeRandomColours(colors, shape);
  39. }
  40. }
  41.  
  42. // Update is called once per frame
  43. void Update()
  44. {
  45. if(GameOver)
  46. {
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement