Example #1
0
        private void PostTeleportUpdate()
        {
            teleportMarker.Hide();
            lastActiveController = null;
            lastRaycastInfo      = null;

            currentTeleportState = TeleporState.WaitingInput;
        }
Example #2
0
        private void WaitingInputUpdate()
        {
            if (isTeleporting)
            {
                return;
            }

            //wait for the teleport to start
            if (leftController.Input.GetButtonDown(teleportEnablerButton) || rightController.Input.GetButtonDown(teleportEnablerButton))
            {
                UpdateActiveController();
                currentTeleportState = TeleporState.PreTeleport;
            }
        }
Example #3
0
        //wait for the player to decide where to teleport
        private void PreTeleportUpdate()
        {
            UpdateActiveController();

            //there is no active controller try to do a teleport
            if (activeController == null)
            {
                //if we can teleport to the last AimRaycast
                if (IsAimRaycastInfoSuitableForTeleporting(lastRaycastInfo))
                {
                    DoTeleport(lastRaycastInfo);
                }

                //clean the line inmediatly
                teleportLineRender.CleanRender();

                //go to post teleport
                currentTeleportState = TeleporState.PostTeleport;
                return;
            }

            Ray controllerRay = new Ray(activeController.transform.position, activeController.transform.forward);

            //use the aimhandler to generate all the line points
            List <Vector3> points = aimHandler.GetAllPoints(controllerRay);
            //use the raycaster
            AimRaycastInfo info = aimRaycaster.Raycast(points, activeController.transform);

            if (info != null)
            {
                teleportLineRender.Render(info.validPoints, info.suitableForTeleporting);
            }
            else
            {
                teleportLineRender.Render(points, false);
            }

            if (IsAimRaycastInfoSuitableForTeleporting(info))
            {
                teleportMarker.UpdatePositionAndRotation(activeController, info);
            }
            else
            {
                teleportMarker.Hide();
            }

            lastRaycastInfo = info;
        }