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 OnEnable() { CollidableObject component = GetComponent <CollidableObject>(); if (component != null) { component.ReloadColliders(); } base.enabled = false; }
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; } } }