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

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Randomizer : MonoBehaviour
{
public Texture2D[] bases;
public Texture2D[] hats;
public Texture2D[] eyes;
public Texture2D[] faces;
public Texture2D[] tops;
public Texture2D[] bottoms;
public GameObject baseObj;
public GameObject hatObj;
public GameObject eyeObj;
public GameObject faceObj;
public GameObject topObj;
public GameObject bottomObj;
[SerializeField]
private bool m_RandomizeOnAwake;
public void RandomizeParts(int a, int b, int c, int d, int e, int f)
{
baseObj.GetComponent<MeshRenderer>().material.mainTexture = bases[a];
hatObj.GetComponent<MeshRenderer>().material.mainTexture = hats[b];
eyeObj.GetComponent<MeshRenderer>().material.mainTexture = eyes[c];
faceObj.GetComponent<MeshRenderer>().material.mainTexture = faces[d];
topObj.GetComponent<MeshRenderer>().material.mainTexture = tops[e];
bottomObj.GetComponent<MeshRenderer>().material.mainTexture = bottoms[f];
}
}