protected virtual bool TestForType <T>(RaycastHit hit, BeatmapObject.Type type) where T : MonoBehaviour { var placementObj = hit.transform.GetComponentInParent <T>(); if (placementObj != null) { var boundLocal = placementObj.GetComponentsInChildren <Renderer>().FirstOrDefault(it => it.name == "Grid X").bounds; // Transform the bounds into the pseudo-world space we use for selection var localTransform = placementObj.transform; var localScale = localTransform.localScale; var boundsNew = localTransform.InverseTransformBounds(boundLocal); boundsNew.center += localTransform.localPosition; boundsNew.extents = new Vector3( boundsNew.extents.x * localScale.x, boundsNew.extents.y * localScale.y, boundsNew.extents.z * localScale.z ); if (bounds == default) { bounds = boundsNew; } else { // Probably a bad idea but why not drag between lanes bounds.Encapsulate(boundsNew); } return(true); } return(false); }
protected override bool TestForType <T>(RaycastHit hit, BeatmapObject.Type type) { if (base.TestForType <T>(hit, type)) { SelectedTypes.Add(type); return(true); } return(false); }
private static void CleanupType(BeatmapObject.Type type) { var eventsContainer = BeatmapObjectContainerCollection.GetCollectionForType(type); foreach (var evt in eventsContainer.LoadedObjects.ToArray()) { eventsContainer.DeleteObject(evt); } }
public static BeatmapObjectContainerCollection GetCollectionForType(BeatmapObject.Type type) { loadedCollections.TryGetValue(type, out BeatmapObjectContainerCollection collection); return(collection); }
public static T GetCollectionForType <T>(BeatmapObject.Type type) where T : BeatmapObjectContainerCollection { loadedCollections.TryGetValue(type, out BeatmapObjectContainerCollection collection); return(collection as T); }