public static DevkitHierarchyWorldObject addDevkitObject(Guid GUID, Vector3 position, Quaternion rotation, Vector3 scale, ELevelObjectPlacementOrigin placementOrigin) { GameObject gameObject = new GameObject(); gameObject.transform.position = position; gameObject.transform.rotation = rotation; gameObject.transform.localScale = scale; DevkitTransactionUtility.recordInstantiation(gameObject); DevkitHierarchyWorldObject devkitHierarchyWorldObject = gameObject.AddComponent <DevkitHierarchyWorldObject>(); LevelHierarchy.initItem(devkitHierarchyWorldObject); devkitHierarchyWorldObject.GUID = GUID; devkitHierarchyWorldObject.placementOrigin = placementOrigin; return(devkitHierarchyWorldObject); }
protected void OnDisable() { WaterSystem.removeVolume(this); LevelHierarchy.removeItem(this); }
protected void OnEnable() { LevelHierarchy.addItem(this); WaterSystem.addVolume(this); }
public NetworkObject(LevelHierarchy l, String t) : base(TypeEntity.InformationAssets, t) { this.level = l; this.TO = t; }
public virtual void update() { if (this.copySelectionDelay.Count > 0) { DevkitSelectionManager.clear(); foreach (GameObject newGameObject in this.copySelectionDelay) { DevkitSelectionManager.add(new DevkitSelection(newGameObject, null)); } this.copySelectionDelay.Clear(); } if (!DevkitNavigation.isNavigating) { if (DevkitInput.canEditorReceiveInput) { if (Input.GetKeyDown(113)) { this.mode = DevkitSelectionTool.ESelectionMode.POSITION; } if (Input.GetKeyDown(119)) { this.mode = DevkitSelectionTool.ESelectionMode.ROTATION; } if (Input.GetKeyDown(114)) { this.mode = DevkitSelectionTool.ESelectionMode.SCALE; } } Ray pointerToWorldRay = DevkitInput.pointerToWorldRay; RaycastHit raycastHit; if (!Physics.Raycast(pointerToWorldRay, ref raycastHit, 8192f, RayMasks.LOGIC)) { Physics.Raycast(pointerToWorldRay, ref raycastHit, 8192f, (int)DevkitSelectionToolOptions.instance.selectionMask); if (DevkitInput.canEditorReceiveInput && Input.GetKeyDown(101) && raycastHit.transform != null) { if (DevkitSelectionManager.selection.Count > 0) { this.handleTeleportTransformed(raycastHit.point, raycastHit.normal); } else { this.instantiate(raycastHit.point, raycastHit.normal); } } } if (DevkitInput.canEditorReceiveInput) { if (Input.GetKeyDown(323)) { this.drag = new DevkitSelection((!(raycastHit.transform != null)) ? null : raycastHit.transform.gameObject, raycastHit.collider); if (this.drag.isValid) { DevkitSelectionManager.data.point = raycastHit.point; this.isDragging = DevkitSelectionManager.beginDrag(this.drag); if (this.isDragging) { DevkitTransactionManager.beginTransaction(new TranslatedText(new TranslationReference("#SDG::Devkit.Transactions.Transform"))); foreach (DevkitSelection devkitSelection in DevkitSelectionManager.selection) { DevkitTransactionUtility.recordObjectDelta(devkitSelection.transform); } } } if (!this.isDragging) { DevkitSelectionManager.data.point = raycastHit.point; this.beginAreaSelect = DevkitInput.pointerViewportPoint; this.beginAreaSelectTime = Time.time; } } if (Input.GetKey(323) && !this.isDragging && !this.isAreaSelecting && Time.time - this.beginAreaSelectTime > 0.1f) { this.isAreaSelecting = true; this.areaSelection.Clear(); if (!Input.GetKey(304) && !Input.GetKey(306)) { DevkitSelectionManager.clear(); } } } if (this.isDragging && this.drag.collider != null) { DevkitSelectionManager.data.point = raycastHit.point; DevkitSelectionManager.continueDrag(this.drag); } if (this.isAreaSelecting) { Vector3 pointerViewportPoint = DevkitInput.pointerViewportPoint; Vector2 vector; Vector2 vector2; if (pointerViewportPoint.x < this.beginAreaSelect.x) { vector.x = pointerViewportPoint.x; vector2.x = this.beginAreaSelect.x; } else { vector.x = this.beginAreaSelect.x; vector2.x = pointerViewportPoint.x; } if (pointerViewportPoint.y < this.beginAreaSelect.y) { vector.y = pointerViewportPoint.y; vector2.y = this.beginAreaSelect.y; } else { vector.y = this.beginAreaSelect.y; vector2.y = pointerViewportPoint.y; } int selectionMask = (int)DevkitSelectionToolOptions.instance.selectionMask; foreach (IDevkitHierarchyItem devkitHierarchyItem in LevelHierarchy.instance.items) { int num = 1 << devkitHierarchyItem.areaSelectGameObject.layer; if ((num & selectionMask) == num) { Vector3 vector3 = MainCamera.instance.WorldToViewportPoint(devkitHierarchyItem.areaSelectCenter); DevkitSelection devkitSelection2 = new DevkitSelection(devkitHierarchyItem.areaSelectGameObject, null); if (vector3.z > 0f && vector3.x > vector.x && vector3.x < vector2.x && vector3.y > vector.y && vector3.y < vector2.y) { if (!this.areaSelection.Contains(devkitSelection2)) { this.areaSelection.Add(devkitSelection2); DevkitSelectionManager.add(devkitSelection2); } } else if (this.areaSelection.Contains(devkitSelection2)) { this.areaSelection.Remove(devkitSelection2); DevkitSelectionManager.remove(devkitSelection2); } } } } if (Input.GetKeyUp(323)) { if (this.isDragging) { if (this.drag.isValid) { DevkitSelectionManager.data.point = raycastHit.point; DevkitSelectionManager.endDrag(this.drag); } this.drag = DevkitSelection.invalid; this.isDragging = false; this.transformSelection(); DevkitTransactionManager.endTransaction(); } else if (this.isAreaSelecting) { this.isAreaSelecting = false; } else if (DevkitInput.canEditorReceiveInput) { DevkitSelectionManager.select(this.drag); } } if (raycastHit.transform != this.hover.transform || raycastHit.collider != this.hover.collider) { if (this.hover.isValid) { DevkitSelectionManager.data.point = raycastHit.point; DevkitSelectionManager.endHover(this.hover); } this.hover.transform = raycastHit.transform; this.hover.collider = raycastHit.collider; if (this.hover.isValid) { DevkitSelectionManager.data.point = raycastHit.point; DevkitSelectionManager.beginHover(this.hover); } } } if (DevkitSelectionManager.selection.Count > 0) { this.handlePosition = Vector3.zero; this.handleRotation = Quaternion.identity; bool flag = !DevkitSelectionToolOptions.instance.localSpace; foreach (DevkitSelection devkitSelection3 in DevkitSelectionManager.selection) { if (!(devkitSelection3.gameObject == null)) { this.handlePosition += devkitSelection3.transform.position; if (!flag) { this.handleRotation = devkitSelection3.transform.rotation; flag = true; } } } this.handlePosition /= (float)DevkitSelectionManager.selection.Count; this.positionGameObject.SetActive(this.mode == DevkitSelectionTool.ESelectionMode.POSITION); this.positionHandle.suggestTransform(this.handlePosition, this.handleRotation); this.rotationGameObject.SetActive(this.mode == DevkitSelectionTool.ESelectionMode.ROTATION); this.rotationHandle.suggestTransform(this.handlePosition, this.handleRotation); this.scaleGameObject.SetActive(this.mode == DevkitSelectionTool.ESelectionMode.SCALE); this.scaleHandle.suggestTransform(this.handlePosition, this.handleRotation); if (DevkitInput.canEditorReceiveInput) { if (Input.GetKeyDown(99)) { this.copyBuffer.Clear(); foreach (DevkitSelection devkitSelection4 in DevkitSelectionManager.selection) { this.copyBuffer.Add(devkitSelection4.gameObject); } } if (Input.GetKeyDown(118)) { TranslationReference newReference = new TranslationReference("#SDG::Devkit.Transactions.Paste"); TranslatedText name = new TranslatedText(newReference); DevkitTransactionManager.beginTransaction(name); foreach (GameObject gameObject in this.copyBuffer) { IDevkitSelectionCopyableHandler component = gameObject.GetComponent <IDevkitSelectionCopyableHandler>(); GameObject gameObject2; if (component != null) { gameObject2 = component.copySelection(); } else { gameObject2 = Object.Instantiate <GameObject>(gameObject); } IDevkitHierarchyItem component2 = gameObject2.GetComponent <IDevkitHierarchyItem>(); if (component2 != null) { component2.instanceID = LevelHierarchy.generateUniqueInstanceID(); } DevkitTransactionUtility.recordInstantiation(gameObject2); this.copySelectionDelay.Add(gameObject2); } DevkitTransactionManager.endTransaction(); } if (Input.GetKeyDown(127)) { TranslationReference newReference2 = new TranslationReference("#SDG::Devkit.Transactions.Delete_Selection"); TranslatedText name2 = new TranslatedText(newReference2); DevkitTransactionManager.beginTransaction(name2); foreach (DevkitSelection devkitSelection5 in DevkitSelectionManager.selection) { DevkitTransactionUtility.recordDestruction(devkitSelection5.gameObject); } DevkitSelectionManager.clear(); DevkitTransactionManager.endTransaction(); } if (Input.GetKeyDown(98)) { this.referencePosition = this.handlePosition; this.referenceRotation = this.handleRotation; this.referenceScale = Vector3.one; this.hasReferenceScale = false; if (DevkitSelectionManager.selection.Count == 1) { foreach (DevkitSelection devkitSelection6 in DevkitSelectionManager.selection) { if (!(devkitSelection6.gameObject == null)) { this.referenceScale = devkitSelection6.transform.localScale; this.hasReferenceScale = true; } } } } if (Input.GetKeyDown(110)) { this.moveHandle(this.referencePosition, this.referenceRotation, this.referenceScale, true, this.hasReferenceScale && DevkitSelectionManager.selection.Count == 1); } if (Input.GetKeyDown(102)) { List <Collider> list = ListPool <Collider> .claim(); List <Renderer> list2 = ListPool <Renderer> .claim(); Bounds bounds; bounds..ctor(this.handlePosition, Vector3.zero); foreach (DevkitSelection devkitSelection7 in DevkitSelectionManager.selection) { if (!(devkitSelection7.gameObject == null)) { list.Clear(); devkitSelection7.gameObject.GetComponentsInChildren <Collider>(list); foreach (Collider collider in list) { bounds.Encapsulate(collider.bounds); } list2.Clear(); devkitSelection7.gameObject.GetComponentsInChildren <Renderer>(list2); foreach (Renderer renderer in list2) { bounds.Encapsulate(renderer.bounds); } } } ListPool <Collider> .release(list); ListPool <Renderer> .release(list2); DevkitNavigation.focus(bounds); } } } else { this.positionGameObject.SetActive(false); this.rotationGameObject.SetActive(false); this.scaleGameObject.SetActive(false); } }
// Token: 0x06000CCB RID: 3275 RVA: 0x0005E608 File Offset: 0x0005CA08 protected void OnDisable() { LevelHierarchy.removeItem(this); }
// Token: 0x06000CCA RID: 3274 RVA: 0x0005E600 File Offset: 0x0005CA00 protected void OnEnable() { LevelHierarchy.addItem(this); }
// Token: 0x06000CEF RID: 3311 RVA: 0x0005F43C File Offset: 0x0005D83C protected void OnEnable() { LevelHierarchy.addItem(this); FoliageVolumeSystem.addVolume(this); }
// Token: 0x06000E6B RID: 3691 RVA: 0x00063B7C File Offset: 0x00061F7C protected void OnDisable() { LandscapeHoleSystem.removeVolume(this); LevelHierarchy.removeItem(this); }
// Token: 0x06000E6A RID: 3690 RVA: 0x00063B6E File Offset: 0x00061F6E protected void OnEnable() { LevelHierarchy.addItem(this); LandscapeHoleSystem.addVolume(this); }