using UnityEngine;
using System.Collections;
public class CubeScript : MonoBehaviour {
public Material Material01;
public Material Material02;
public Material Material03;
public Material Material04;
private Material currentMaterial ;
int i = 0;
private Renderer rend;
// Use this for initialization
void Start () {
Debug.Log(111);
// currentMaterial = Material01;
rend = GetComponent<Renderer>();
rend.material = Material01;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Joystick1Button0))
{
i ++ ;
Debug.Log(333);
if (i == 1)
{
rend.material = Material02;
// i ++;
Debug.Log(444);
// currentMaterial = Material02;
}
if (i == 2)
{
Debug.Log(444);
rend.material = Material03;
//currentMaterial = Material03;
}
if (i == 3)
{
rend.material = Material04;
i = 0;
}
}
}
}
网友评论