public void AddListener(GyroObj target) { if (target && !m_handleList.Contains(target)) { m_handleList.Add(target); } }
public void RemoveListener(GyroObj target) { if (target && m_handleList.Contains(target)) { m_handleList.Remove(target); } }
// Use this for initialization void Start() { protocol = GameObject.Find("rs232obj").GetComponent <GyroObj>(); mesh = new MeshRenderer[20]; text = new TextMesh[10]; timeOfTrack = new List <float> [10]; Nodes = new List <Node> [10]; keyState = new KeyState[10]; for (int i = 0; i < 10; i++) { keyState[i] = KeyState.NOPRESS; } trackIndex = new List <int>(); checkIndex = new List <int>(); for (int i = 0; i < keyObjs.Length; i++) { mesh[i] = keyObjs[i].GetComponent <MeshRenderer>(); text[i] = keyObjs[i].transform.GetChild(0).GetComponent <TextMesh>(); mesh[i + 10] = tracks[i].GetComponent <MeshRenderer>(); } for (int i = 0; i < timeOfTrack.Length; i++) { timeOfTrack[i] = new List <float>(); Nodes[i] = new List <Node>(); trackIndex.Add(0); checkIndex.Add(0); } }
public void Update(Vector3 position, Vector3 rotationVec, float deltaTime) { for (int i = 0; i < m_handleList.Count; i++) { GyroObj tran = m_handleList[i]; if (tran) { tran.UpdateGyro(position, rotationVec, deltaTime); } else { m_handleList.Remove(tran); } } }