Example #1
0
        void tryTeleport()
        {
            if (validTeleport)
            {
                // Call any Before Teleport Events
                OnBeforeTeleport?.Invoke();

                Vector3    destination = TeleportDestination.position;
                Quaternion rotation    = TeleportMarker.transform.rotation;

                // Override if we're looking at a teleport destination
                var dest = _hitObject.GetComponent <TeleportDestination>();
                if (dest != null)
                {
                    destination = dest.DestinationTransform.position;

                    if (dest.ForcePlayerRotation)
                    {
                        rotation = dest.DestinationTransform.rotation;
                    }
                }

                StartCoroutine(doTeleport(destination, rotation, AllowTeleportRotation));
            }

            // We teleported, so update this value for next raycast
            validTeleport  = false;
            aimingTeleport = false;

            hideTeleport();
        }
Example #2
0
        public virtual void BeforeTeleport()
        {
            if (FadeScreenOnTeleport && fader)
            {
                fader.FadeInSpeed = TeleportFadeSpeed;
                fader.DoFadeIn();
            }

            // Call any Before Teleport Events
            OnBeforeTeleport?.Invoke();
        }