public GameObject CreateCheckPoint(ICheckPoint checkPoint) { GameObject go = Instantiate(CheckPointPrefabs[checkPoint.GetPointType()], m_Root.transform); UnityCheckPoint unityCheckPoint = go.GetComponent <UnityCheckPoint>(); go.name = "checkPoint " + checkPoint.GetX() + " " + checkPoint.GetY(); go.transform.position = new Vector3(checkPoint.GetX() * CellSize, 0, checkPoint.GetY() * CellSize); m_CheckPoints.Add(unityCheckPoint); unityCheckPoint.Init(checkPoint); return(go); }
public void RemoveCheckPointAt(int x, int y) { for (int i = 0; i < m_CheckPoints.Count; ++i) { ICheckPoint checkPointObj = m_CheckPoints[i].GetCheckPoint(); if (checkPointObj.GetX().Equals(x) && checkPointObj.GetY().Equals(y)) { DestroyImmediate(m_CheckPoints[i].gameObject); m_CheckPoints.RemoveAt(i); break; } } }