Example #1
0
        private void HandleInteractionRemoved(Vector3 interactableSnappedPos, ILightInteractor interactor)
        {
            if (interactableSnappedPos.Snapped() != transform.position.Snapped())
            {
                return;
            }

            if (currentInteractors.Contains(interactor))
            {
                currentInteractors.Remove(interactor);
                interactor.HandleUnblockedInteraction();
            }

            if (IsUnlocked())
            {
                return;
            }
            ReEnableGate();
        }
Example #2
0
        public IEnumerator HandleInteraction(ILightInteractor interactor)
        {
            currentInteractor = interactor;
            while (Vector3.Distance(interactor.Behaviour.transform.position, transform.position) > .05f)
            {
                yield return(new WaitForEndOfFrame());
            }

            if (rotationInteraction != null)
            {
                // stop movement if mirror is currently rotating
                interactor.Behaviour.GetComponent <LightMovement>().enabled = false;
                while (rotationInteraction.Rotating)
                {
                    yield return(new WaitForEndOfFrame());
                }
            }

            interactor.Behaviour.transform.SetPositionAndRotation(transform.position.Snapped(), transform.rotation);
            interactor.HandleUnblockedInteraction();
            interactor.HandleReactivation();
            currentInteractor = null;
        }