/// <summary> /// CollisionSkin moved /// </summary> /// <param name="skin"></param> public override void CollisionSkinMoved(CollisionSkin skin) { GridEntry entry = (GridEntry)skin.ExternalData; if (entry == null) { System.Diagnostics.Debug.WriteLine("Warning skin has grid entry null!"); return; } int gridIndex = CalcGridIndexForSkin(skin); // see if it's moved grid if (gridIndex == entry.GridIndex) { return; } GridEntry start; if (gridIndex >= 0) { start = gridEntries[gridIndex]; } else { start = overflowEntries; } GridEntry.RemoveGridEntry(entry); GridEntry.InsertGridEntryAfter(entry, start); }
/// <summary> /// Removes a CollisionSkin /// </summary> /// <param name="skin"></param> /// <returns>bool</returns> public override bool RemoveCollisionSkin(CollisionSkin skin) { GridEntry entry = (GridEntry)skin.ExternalData; if (entry != null) { entry.Skin = null; freeGrids.Push(entry); GridEntry.RemoveGridEntry(entry); skin.ExternalData = null; } else { System.Diagnostics.Debug.WriteLine("Warning - skin being deleted without a grid entry"); } if (!skins.Contains(skin)) { return(false); } skins.Remove(skin); return(true); }