using UnityEngine;
using System.Collections;
struct SimonLightPlate
{
public enum eType
{
INVALID_TYPE = -1,
BLUE,
GREEN,
RED,
YELLOW,
NUM_TYPES
}
public SimonLightPlate(string plateName)
{
plate = GameObject.Find(plateName);
}
public GameObject plate; // The plate associated with the colors
}
public class SimonSays : MonoBehaviour
{
SimonLightPlate[] lightPlates = new SimonLightPlate[(int)SimonLightPlate.eType.NUM_TYPES];
// Use this for initialization
void Start ()
{
lightPlates[(int)SimonLightPlate.eType.BLUE] = new SimonLightPlate("BluePlane");
lightPlates[(int)SimonLightPlate.eType.GREEN] = new SimonLightPlate("GreenPlane");
lightPlates[(int)SimonLightPlate.eType.RED] = new SimonLightPlate("RedPlane");
lightPlates[(int)SimonLightPlate.eType.YELLOW] = new SimonLightPlate("YellowPlane");
}
// Update is called once per frame
void Update ()
{
}
}
- 做什么的
(int)
?这行代码有什么作用:
SimonLightPlate[] lightPlates = new
SimonLightPlate[(int)SimonLightPlate.eType.NUM_TYPES];
? 这是做什么的:lightPlates[(int)SimonLightPlate.eType.BLUE] = new
SimonLightPlate("BluePlane");
?
- 公众也会
GameObject plate;
怎么做?