// ------------------------------------------- /* * Stop existing gameobject */ public bool Stop(GameObject _actor) { for (int i = 0; i < m_rotatorObjects.Count; i++) { RotatorData item = m_rotatorObjects[i]; if (item.GameActor == _actor) { item.Destroy(); m_rotatorObjects.RemoveAt(i); return(true); } } return(false); }
// ------------------------------------------- /* * Logic */ public void Logic() { try { for (int i = 0; i < m_rotatorObjects.Count; i++) { RotatorData itemData = m_rotatorObjects[i]; if (itemData.Inperpolate()) { itemData.Destroy(); m_rotatorObjects.RemoveAt(i); i--; } } } catch (Exception err) { }; for (int j = 0; j < m_rotatorQueue.Count; j++) { RotatorData newItem = m_rotatorQueue[j]; bool found = false; for (int i = 0; i < m_rotatorObjects.Count; i++) { RotatorData item = m_rotatorObjects[i]; if (item.GameActor == newItem.GameActor) { item.ResetData(newItem.GameActor.transform.rotation, newItem.Goal, newItem.TotalTime, 0); found = true; } } if (!found) { m_rotatorObjects.Add(newItem); } else { newItem.Destroy(); newItem = null; } } m_rotatorQueue.Clear(); }