private static void SortListSimple(List <SpriteSorting> list) { list.Sort((a, b) => { if (!a || !b) { return(0); } else { return(SpriteSorting.CompareIsoSorters(a, b)); } }); }
private static void AddMovingDependenciesToMovingSprites(List <SpriteSorting> moveableList) { for (int i = 0; i < moveableList.Count; i++) { SpriteSorting sprite1 = moveableList[i]; for (int j = 0; j < moveableList.Count; j++) { SpriteSorting sprite2 = moveableList[j]; if (CalculateBoundsIntersection(sprite1, sprite2)) { int compareResult = SpriteSorting.CompareIsoSorters(sprite1, sprite2); if (compareResult == -1) { sprite2.movingDependencies.Add(sprite1); } } } } }
private static void SetupStaticDependencies(SpriteSorting newSprite) { int the_count = staticSpriteList.Count; for (int i = 0; i < the_count; i++) { SpriteSorting otherSprite = staticSpriteList[i]; if (CalculateBoundsIntersection(newSprite, otherSprite)) { int compareResult = SpriteSorting.CompareIsoSorters(newSprite, otherSprite); if (compareResult == -1) { otherSprite.staticDependencies.Add(newSprite); newSprite.inverseStaticDependencies.Add(otherSprite); } else if (compareResult == 1) { newSprite.staticDependencies.Add(otherSprite); otherSprite.inverseStaticDependencies.Add(newSprite); } } } }
private static void AddMovingDependenciesToStaticSprites(List <SpriteSorting> moveableList, List <SpriteSorting> staticList) { for (int i = 0; i < moveableList.Count; i++) { SpriteSorting moveSprite = moveableList[i]; for (int j = 0; j < staticList.Count; j++) { SpriteSorting staticSprite = staticList[j]; if (CalculateBoundsIntersection(moveSprite, staticSprite)) { int compareResult = SpriteSorting.CompareIsoSorters(moveSprite, staticSprite); if (compareResult == -1) { staticSprite.movingDependencies.Add(moveSprite); } else if (compareResult == 1) { moveSprite.movingDependencies.Add(staticSprite); } } } } }