using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class ChangeDemo : MonoBehaviour {
public SkinnedMeshRenderer headMeshes;
public SkinnedMeshRenderer handMeshes;
public SkinnedMeshRenderer footMeshes;
public Mesh[] headMesh;
public Mesh[] handMesh;
public Mesh[] footMesh;
private SkinnedMeshRenderer[] allMesh;
private int index=0;
void Start () {
allMesh=this.GetComponentsInChildren<SkinnedMeshRenderer>();
}
public void OnHeadLeftClicked(){
index--;
if(index<0){
index=0;
headMeshes.sharedMesh=headMesh[index];
}
Info.head = headMesh [index];
}
public void OnHeadRightClicked(){
index++;
if(index>headMesh.Length){
index=handMesh.Length-1;
headMeshes.sharedMesh=headMesh[index];
}
Info.head = headMesh [index-1];
}
public void OnHandLeftClicked(){
index--;
if(index<0){
index=0;
handMeshes.sharedMesh=handMesh[index];
}
Info.hand = handMesh [index];
}
public void OnHandRightClicked(){
index++;
if(index>handMesh.Length){
index=handMesh.Length-1;
handMeshes.sharedMesh=handMesh[index];
}
Info.hand = handMesh [index-1];
}
public void OnFootLeftClicked(){
index--;
if(index<0){
index=0;
footMeshes.sharedMesh=footMesh[index];
}
Info.foot= footMesh [index];
}
public void OnFootRightClicked(){
index++;
if(index>footMesh.Length){
index=footMesh.Length-1;
footMeshes.sharedMesh=footMesh[index];
}
Info.foot= footMesh [index-1];
}
public void OnRedClicked(){
for (int i = 0; i < allMesh.Length; i++) {
allMesh[i].material.color=Color.red;
}
Info.color = Color.red;
}
public void OnGreenClicked(){
for (int i = 0; i < allMesh.Length; i++) {
allMesh[i].material.color=Color.green;
}
Info.color = Color.green;
}
public void OnStartClicked(){
SceneManager.LoadScene ("Loading");
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class ChangeDemo : MonoBehaviour {
public SkinnedMeshRenderer headMeshes;
public SkinnedMeshRenderer handMeshes;
public SkinnedMeshRenderer footMeshes;
public Mesh[] headMesh;
public Mesh[] handMesh;
public Mesh[] footMesh;
private SkinnedMeshRenderer[] allMesh;
private int index=0;
void Start () {
allMesh=this.GetComponentsInChildren<SkinnedMeshRenderer>();
}
public void OnHeadLeftClicked(){
index--;
if(index<0){
index=0;
headMeshes.sharedMesh=headMesh[index];
}
Info.head = headMesh [index];
}
public void OnHeadRightClicked(){
index++;
if(index>headMesh.Length){
index=handMesh.Length-1;
headMeshes.sharedMesh=headMesh[index];
}
Info.head = headMesh [index-1];
}
public void OnHandLeftClicked(){
index--;
if(index<0){
index=0;
handMeshes.sharedMesh=handMesh[index];
}
Info.hand = handMesh [index];
}
public void OnHandRightClicked(){
index++;
if(index>handMesh.Length){
index=handMesh.Length-1;
handMeshes.sharedMesh=handMesh[index];
}
Info.hand = handMesh [index-1];
}
public void OnFootLeftClicked(){
index--;
if(index<0){
index=0;
footMeshes.sharedMesh=footMesh[index];
}
Info.foot= footMesh [index];
}
public void OnFootRightClicked(){
index++;
if(index>footMesh.Length){
index=footMesh.Length-1;
footMeshes.sharedMesh=footMesh[index];
}
Info.foot= footMesh [index-1];
}
public void OnRedClicked(){
for (int i = 0; i < allMesh.Length; i++) {
allMesh[i].material.color=Color.red;
}
Info.color = Color.red;
}
public void OnGreenClicked(){
for (int i = 0; i < allMesh.Length; i++) {
allMesh[i].material.color=Color.green;
}
Info.color = Color.green;
}
public void OnStartClicked(){
SceneManager.LoadScene ("Loading");
}
}