private void Awake() { World world = Container.Resolve <World>(); world.Subscribe <CancelMessage>(delegate { if (!gameObject.activeSelf) { return; } Destroy(gameObject); }); world.Subscribe <SubmitMessage>(delegate { if (!gameObject.activeSelf) { return; } HandleComponent handle = LinkedEntity.Get <HandleComponent>(); handle.Entity.ApplyCommand(new ProcessActionCommand( handle.Action, LinkedEntity.Get <PositionComponent>().Value )); gameObject.SetActive(false); }); }
void OnSceneGUI() { HandleComponent handleComponent = (HandleComponent)target; if (handleComponent == null) { return; } if (handleComponent.thisCamera == null) { return; } Handles.Label(handleComponent.transform.position + Vector3.up * 2, handleComponent.gameObject.name + " FOV \nV: " + handleComponent.thisCamera.fieldOfView.ToString()); }
public void ExecuteHandleObjects(bool active, HandleComponent handleOriginalObjects, HandleComponent handleOriginalLodGroups, bool includeColliders = true) { Methods.SetChildrenActive(transform, !active); if (handleOriginalObjects == HandleComponent.Disable) { if (includeColliders) { SetOriginalCollidersActive(active); } for (int i = 0; i < foundObjects.Count; i++) { CachedGameObject cachedGO = foundObjects[i]; if (cachedGO.mr) { cachedGO.mr.enabled = active; } else { Methods.ListRemoveAt(foundObjects, i--); } } for (int i = 0; i < foundLodObjects.Count; i++) { CachedLodGameObject cachedLodGO = foundLodObjects[i]; if (cachedLodGO.mr) { cachedLodGO.mr.enabled = active; } else { Methods.ListRemoveAt(foundLodObjects, i--); } } } if (handleOriginalObjects == HandleComponent.Destroy) { for (int i = 0; i < foundColliders.Count; i++) { Collider collider = foundColliders[i]; if (collider) { Destroy(collider); } else { Methods.ListRemoveAt(foundColliders, i--); } } for (int i = 0; i < foundObjects.Count; i++) { bool remove = false; CachedGameObject cachedGO = foundObjects[i]; if (cachedGO.mf) { Destroy(cachedGO.mf); } else { remove = true; } if (cachedGO.mr) { Destroy(cachedGO.mr); } else { remove = true; } if (remove) { Methods.ListRemoveAt(foundObjects, i--); } } for (int i = 0; i < foundLodObjects.Count; i++) { bool remove = false; CachedGameObject cachedGO = foundLodObjects[i]; if (cachedGO.mf) { Destroy(cachedGO.mf); } else { remove = true; } if (cachedGO.mr) { Destroy(cachedGO.mr); } else { remove = true; } if (remove) { Methods.ListRemoveAt(foundLodObjects, i--); } } } if (handleOriginalLodGroups == HandleComponent.Disable) { for (int i = 0; i < foundLodGroups.Count; i++) { LODGroup lodGroup = foundLodGroups[i]; if (lodGroup) { lodGroup.enabled = active; } } } else if (handleOriginalLodGroups == HandleComponent.Destroy) { for (int i = 0; i < foundLodGroups.Count; i++) { LODGroup lodGroup = foundLodGroups[i]; if (lodGroup != null) { Destroy(lodGroup); } } } }