Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- [System.Serializable]
- public class Shape
- {
- public GameObject Prefab;
- public SpriteRenderer[] InnerImages;
- public Vector3 Position;
- public Quaternion Rotation;
- public string ShapeTag;
- public void CreateShape(GameObject gameObject, SpriteRenderer[] images, Vector3 pos, Quaternion rot, string tag)
- {
- Prefab = gameObject;
- InnerImages = images;
- Position = pos;
- Rotation = rot;
- ShapeTag = tag;
- }
- Shape GetShape()
- {
- return this;
- }
- void SetShapePosition(Vector3 pos)
- {
- Position = pos;
- }
- public Shape SetShapeRandomColours(Color[] colors, Shape shape)
- {
- if(colors.Length != 0)
- {
- foreach(SpriteRenderer sr in shape.InnerImages)
- {
- sr.color = colors[GetRandom(colors.Length)];
- }
- }else{
- Debug.Log("NO COLOURS TO RANDOMISE>..");
- }
- return shape;
- }
- //GENERIC RETURN RANDOM METHOD.
- private int GetRandom(int itemLength)
- {
- int random = Random.Range(0, itemLength);
- return random;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement