コード例 #1
0
        private IEnumerator HandleTeleportToRoom(PlayerController targetPlayer, Vector2 targetPoint)
        {
            // if (targetPlayer.transform.position.GetAbsoluteRoom() != null) { StunEnemiesForTeleport(targetPlayer.transform.position.GetAbsoluteRoom(), 0.25f); }
            CameraController cameraController = GameManager.Instance.MainCameraController;
            Vector2          offsetVector     = (cameraController.transform.position - targetPlayer.transform.position);

            offsetVector -= cameraController.GetAimContribution();
            cameraController.SetManualControl(true, false);
            cameraController.OverridePosition = cameraController.transform.position;
            yield return(new WaitForSeconds(0.1f));

            targetPlayer.transform.position = targetPoint;
            targetPlayer.specRigidbody.Reinitialize();
            targetPlayer.specRigidbody.RecheckTriggers = true;
            if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER)
            {
                cameraController.OverridePosition = cameraController.GetIdealCameraPosition();
            }
            else
            {
                cameraController.OverridePosition = (targetPoint + offsetVector).ToVector3ZUp(0f);
            }
            targetPlayer.WarpFollowersToPlayer();
            targetPlayer.WarpCompanionsToPlayer(false);
            ExpandCombatRoomManager CombatManager = null;

            if (targetPlayer.transform.position.GetAbsoluteRoom() != null)
            {
                StunEnemiesForTeleport(targetPlayer.transform.position.GetAbsoluteRoom(), 1.8f);
                GameObject RoomManager = new GameObject("Room Manager")
                {
                    layer = 0
                };
                RoomManager.transform.position = targetPlayer.transform.position;
                RoomManager.transform.parent   = targetPlayer.transform.position.GetAbsoluteRoom().hierarchyParent;
                CombatManager            = RoomManager.AddComponent <ExpandCombatRoomManager>();
                CombatManager.ParentRoom = targetPlayer.transform.position.GetAbsoluteRoom();
            }
            Pixelator.Instance.MarkOcclusionDirty();
            yield return(null);

            if (CombatManager)
            {
                CombatManager.Activated = true;
            }
            cameraController.SetManualControl(false, true);
            yield return(new WaitForSeconds(0.15f));

            targetPlayer.DoVibration(Vibration.Time.Normal, Vibration.Strength.Medium);
            PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(targetPlayer.specRigidbody, null, false);
            m_IsTeleporting = false;
            yield break;
        }
コード例 #2
0
        private IEnumerator HandleTeleportToRoom(PlayerController targetPlayer, Vector2 targetPoint)
        {
            if (targetPlayer.transform.position.GetAbsoluteRoom() != null)
            {
                StunEnemiesForTeleport(targetPlayer.transform.position.GetAbsoluteRoom(), 1f);
            }
            targetPlayer.healthHaver.IsVulnerable = false;
            CameraController cameraController = GameManager.Instance.MainCameraController;
            Vector2          offsetVector     = (cameraController.transform.position - targetPlayer.transform.position);

            offsetVector -= cameraController.GetAimContribution();
            Minimap.Instance.ToggleMinimap(false, false);
            cameraController.SetManualControl(true, false);
            cameraController.OverridePosition = cameraController.transform.position;
            targetPlayer.CurrentInputState    = PlayerInputState.NoInput;
            yield return(new WaitForSeconds(0.1f));

            DoTentacleVFX(targetPlayer);
            // yield return new WaitForSeconds(0.4f);
            yield return(new WaitForSeconds(1));

            targetPlayer.ToggleRenderer(false, "arbitrary teleporter");
            targetPlayer.ToggleGunRenderers(false, "arbitrary teleporter");
            targetPlayer.ToggleHandRenderers(false, "arbitrary teleporter");
            yield return(new WaitForSeconds(1));

            Pixelator.Instance.FadeToBlack(0.15f, false, 0f);
            yield return(new WaitForSeconds(0.15f));

            // targetPlayer.specRigidbody.Position = new Position(targetPoint);
            targetPlayer.transform.position = targetPoint;
            targetPlayer.specRigidbody.Reinitialize();
            targetPlayer.specRigidbody.RecheckTriggers = true;
            if (GameManager.Instance.CurrentGameType == GameManager.GameType.COOP_2_PLAYER)
            {
                cameraController.OverridePosition = cameraController.GetIdealCameraPosition();
            }
            else
            {
                cameraController.OverridePosition = (targetPoint + offsetVector).ToVector3ZUp(0f);
            }
            targetPlayer.WarpFollowersToPlayer();
            targetPlayer.WarpCompanionsToPlayer(false);
            ExpandCombatRoomManager CombatManager = null;

            if (targetPlayer.transform.position.GetAbsoluteRoom() != null)
            {
                StunEnemiesForTeleport(targetPlayer.transform.position.GetAbsoluteRoom(), 1.8f);
                GameObject RoomManager = new GameObject("Room Manager")
                {
                    layer = 0
                };
                RoomManager.transform.position = targetPlayer.transform.position;
                RoomManager.transform.parent   = targetPlayer.transform.position.GetAbsoluteRoom().hierarchyParent;
                CombatManager            = RoomManager.AddComponent <ExpandCombatRoomManager>();
                CombatManager.ParentRoom = targetPlayer.transform.position.GetAbsoluteRoom();
            }
            Pixelator.Instance.MarkOcclusionDirty();
            Pixelator.Instance.FadeToBlack(0.15f, true, 0f);
            yield return(null);

            if (CombatManager)
            {
                CombatManager.Activated = true;
            }
            cameraController.SetManualControl(false, true);
            // yield return new WaitForSeconds(0.75f);
            yield return(new WaitForSeconds(0.15f));

            DoTentacleVFX(targetPlayer);
            targetPlayer.DoVibration(Vibration.Time.Normal, Vibration.Strength.Medium);
            // yield return new WaitForSeconds(0.25f);
            yield return(new WaitForSeconds(1.7f));

            targetPlayer.ToggleRenderer(true, "arbitrary teleporter");
            targetPlayer.ToggleGunRenderers(true, "arbitrary teleporter");
            targetPlayer.ToggleHandRenderers(true, "arbitrary teleporter");
            PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(targetPlayer.specRigidbody, null, false);
            targetPlayer.CurrentInputState        = PlayerInputState.AllInput;
            targetPlayer.healthHaver.IsVulnerable = true;
            m_IsTeleporting = false;
            yield break;
        }