Beispiel #1
0
    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);
    }
Beispiel #2
0
 protected override bool TestForType <T>(RaycastHit hit, BeatmapObject.Type type)
 {
     if (base.TestForType <T>(hit, type))
     {
         SelectedTypes.Add(type);
         return(true);
     }
     return(false);
 }
Beispiel #3
0
        private static void CleanupType(BeatmapObject.Type type)
        {
            var eventsContainer = BeatmapObjectContainerCollection.GetCollectionForType(type);

            foreach (var evt in eventsContainer.LoadedObjects.ToArray())
            {
                eventsContainer.DeleteObject(evt);
            }
        }
Beispiel #4
0
 public static BeatmapObjectContainerCollection GetCollectionForType(BeatmapObject.Type type)
 {
     loadedCollections.TryGetValue(type, out BeatmapObjectContainerCollection collection);
     return(collection);
 }
Beispiel #5
0
 public static T GetCollectionForType <T>(BeatmapObject.Type type) where T : BeatmapObjectContainerCollection
 {
     loadedCollections.TryGetValue(type, out BeatmapObjectContainerCollection collection);
     return(collection as T);
 }