コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
        public void OnEnable()
        {
            CollidableObject component = GetComponent <CollidableObject>();

            if (component != null)
            {
                component.ReloadColliders();
            }
            base.enabled = false;
        }
コード例 #3
0
        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;
                }
            }
        }