Ejemplo n.º 1
0
 private void RemovePrefab(PrefabRank rank)
 {
     //we can only remove the first or the last prefab
     if (rank == PrefabRank.First)
     {
         //Move the world left border
         worldLeftBound += elementsOnScreen[0].width;
         //Disable the gameObject
         elementsOnScreen[0].Remove();
         //Remove it from the onScreen list
         elementsOnScreen.RemoveAt(0);
     }
     else
     {
         //Move the world Right border
         worldRightBound -= elementsOnScreen[elementsOnScreen.Count - 1].width;
         //Disable the gameObject
         elementsOnScreen[elementsOnScreen.Count - 1].Remove();
         //Remove it from the onScreen list
         elementsOnScreen.RemoveAt(elementsOnScreen.Count - 1);
     }
 }
 private void RemovePrefab(PrefabRank rank)
 {
     //we can only remove the first or the last prefab
     if(rank == PrefabRank.First){
         //Move the world left border
         worldLeftBound+=elementsOnScreen[0].width;
         //Disable the gameObject
         elementsOnScreen[0].Remove();
         //Remove it from the onScreen list
         elementsOnScreen.RemoveAt(0);
     }else{
         //Move the world Right border
         worldRightBound-=elementsOnScreen[elementsOnScreen.Count-1].width;
         //Disable the gameObject
         elementsOnScreen[elementsOnScreen.Count-1].Remove();
         //Remove it from the onScreen list
         elementsOnScreen.RemoveAt(elementsOnScreen.Count-1);
     }
 }