private void OnObjectManipulatorObjectDeselected(ObjectManipulator objectManipulator) { if (objectManipulator.IsAllowed) { SplitChildren(); } }
public void SetObjectManipulator(ObjectManipulator objectManipulator) { this.objectManipulator = objectManipulator; Select(); objectManipulator.IsAllowedChanged += onObjectManipulatorIsAllowedChanged; objectManipulator.GetComponent <ManipulatableObject>().IsSquashedChanged += onObjectManipulatorIsSquashedChanged; }
private void OnSelectedObjectManipulatorTriggerEnter(Collider otherCollider) { ObjectManipulator currentObjectManipulator = objectManipulationInputController.CurrentObjectManipulator; CollidableObject componentInParent = otherCollider.gameObject.GetComponentInParent <CollidableObject>(); if (componentInParent != null && currentObjectManipulator != null) { switch (objectManipulationInputController.GetCollisionRule(componentInParent)) { case CollisionRuleResult.Intersect: break; case CollisionRuleResult.NotAllowed: currentObjectManipulator.CollisionIsValid = false; break; case CollisionRuleResult.Squash: componentInParent.IsSquashed = true; break; case CollisionRuleResult.Stack: case CollisionRuleResult.StackXNormal: break; } } }
public void WatchObject(ObjectManipulator m) { if (m != null) { m.TriggerEnter += OnSelectedObjectManipulatorTriggerEnter; m.TriggerExit += OnSelectedObjectManipulatorTriggerExit; } }
private void onConfirmSquashedObjectBeforeDragComplete(ObjectManipulator selected, Action <bool> callback) { if (selected == null) { return; } HashSet <ManipulatableObject> squashed = new HashSet <ManipulatableObject>(); foreach (Collider currentCollider in selected.CurrentColliders) { ManipulatableObject componentInParent = currentCollider.GetComponentInParent <ManipulatableObject>(); if (componentInParent != null && componentInParent.IsSquashed) { squashed.Add(componentInParent); ManipulatableObject[] componentsInChildren = componentInParent.GetComponentsInChildren <ManipulatableObject>(); for (int i = 0; i < componentsInChildren.Length; i++) { squashed.Add(componentsInChildren[i]); } } } Action <int, Action <bool> > confirmObjectRemoval = Service.Get <ObjectManipulationService>().ConfirmObjectRemoval; if (squashed.Count > 0 && confirmObjectRemoval != null) { confirmObjectRemoval(squashed.Count, delegate(bool delete) { if (delete) { foreach (ManipulatableObject item in squashed) { if (item != null) { item.RemoveObject(deleteChildren: false); } } } objectManipulationInputController.SkipOneFrame = true; if (callback != null) { callback(delete); } }); return; } foreach (ManipulatableObject item2 in squashed) { if (item2 != null) { item2.RemoveObject(deleteChildren: false); } } if (callback != null) { callback(obj: true); } }
public void ClearObjectManipulator() { if (objectManipulator != null) { Deselect(); objectManipulator.IsAllowedChanged -= onObjectManipulatorIsAllowedChanged; objectManipulator.GetComponent <ManipulatableObject>().IsSquashedChanged -= onObjectManipulatorIsSquashedChanged; objectManipulator = null; } }
public void SetTrackedObject(ObjectManipulator obj, int size, ObjectManipulationInputController inputController) { trackedObject = obj; trackedObjectSize = size; if (base.isActiveAndEnabled) { enabledAttractionPoints(); } this.inputController = inputController; inputController.BeforeDragPosition += checkForSnapPosition; }
public void ClearTrackedObject() { if (attractors != null) { trackedObject = null; trackedObjectSize = 0; disableColliders(oddAttractionPoints); disableColliders(evenAttractionPoints); } if (inputController != null) { inputController.BeforeDragPosition -= checkForSnapPosition; } }
private void OnSelectedObjectManipulatorTriggerExit(Collider otherCollider) { ObjectManipulator currentObjectManipulator = objectManipulationInputController.CurrentObjectManipulator; if (!(currentObjectManipulator != null)) { return; } currentObjectManipulator.CollisionIsValid = objectManipulationInputController.IsSelectedObjectAllowedInCurrentPosition(); CollidableObject componentInParent = otherCollider.gameObject.GetComponentInParent <CollidableObject>(); if (componentInParent != null) { CollisionRuleResult collisionRule = objectManipulationInputController.GetCollisionRule(componentInParent); if (collisionRule == CollisionRuleResult.Squash) { componentInParent.IsSquashed = false; } } }
private void onObjectManipulationInputControllerObjectDeselected(ObjectManipulator m) { m.TriggerEnter -= OnSelectedObjectManipulatorTriggerEnter; m.TriggerExit -= OnSelectedObjectManipulatorTriggerExit; }