Global Game Jam 2021
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1 KiB

3 years ago
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Randomizer : MonoBehaviour
  5. {
  6. public Texture2D[] bases;
  7. public Texture2D[] hats;
  8. public Texture2D[] eyes;
  9. public Texture2D[] faces;
  10. public Texture2D[] tops;
  11. public Texture2D[] bottoms;
  12. public GameObject baseObj;
  13. public GameObject hatObj;
  14. public GameObject eyeObj;
  15. public GameObject faceObj;
  16. public GameObject topObj;
  17. public GameObject bottomObj;
  18. [SerializeField]
  19. private bool m_RandomizeOnAwake;
  20. public void RandomizeParts(int a, int b, int c, int d, int e, int f)
  21. {
  22. baseObj.GetComponent<MeshRenderer>().material.mainTexture = bases[a];
  23. hatObj.GetComponent<MeshRenderer>().material.mainTexture = hats[b];
  24. eyeObj.GetComponent<MeshRenderer>().material.mainTexture = eyes[c];
  25. faceObj.GetComponent<MeshRenderer>().material.mainTexture = faces[d];
  26. topObj.GetComponent<MeshRenderer>().material.mainTexture = tops[e];
  27. bottomObj.GetComponent<MeshRenderer>().material.mainTexture = bottoms[f];
  28. }
  29. }