Advertisement
Guest User

Shape

a guest
Feb 25th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. public void CreateShape(GameObject gameObject, SpriteRenderer[] images, Vector2 pos, Quaternion rot)
  2. {
  3. Prefab = gameObject;
  4. InnerImages = images;
  5. Position = pos;
  6. Rotation = rot;
  7. }
  8.  
  9. Shape GetShape()
  10. {
  11. return this;
  12. }
  13.  
  14. void SetShapePosition(Vector2 pos)
  15. {
  16. Position = pos;
  17. }
  18.  
  19. public Shape SetShapeRandomColours(Color[] colors, Shape shape)
  20. {
  21. if(colors.Length != 0)
  22. {
  23. foreach(SpriteRenderer sr in shape.InnerImages)
  24. {
  25. sr.color = colors[GetRandom(colors.Length)];
  26. }
  27. }else{
  28. Debug.Log("NO COLOURS TO RANDOMISE>..");
  29. }
  30.  
  31. return shape;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement