예제 #1
0
        /// <summary>
        /// Have the player respawn at the last checkpoint.
        /// </summary>
        public void Respawn()
        {
            ResetManager.Reset();

            playerSprite.enabled = true;
            player.Physics.Enable();

            try {
                Vector3 position = TransitionManager.GetCurrentSpawnPosition();
                if (position != Vector3.positiveInfinity)
                {
                    player.Physics.Position = position;
                }

                player.Physics.Velocity = Vector2.zero;

                bool   facingRight = TransitionManager.GetCurrentSpawnFacing();
                Facing facing      = facingRight ? Facing.Right : Facing.Left;
                player.SetFacing(facing);
            } catch (UnityException e) {
                Debug.Log(e);
            }

            StartCoroutine(_WaitToEnableControls());
        }
예제 #2
0
        /// <summary>
        /// Deactivate the vCam if the player leaves its trigger collider.
        /// </summary>
        /// <param name="col">The collider that's intersecting the vCam collider</param>
        public void PullTriggerExit2D(Collider2D col)
        {
            if (col.gameObject.CompareTag("Player"))
            {
                if (TargettingCamera.target == cameraSettings.transform)
                {
                    // Don't reset if you're turning the vCam off.
                    // TODO: this is breaking either the boss battle OR the start of
                    // scenes the player's in.
                    if (gameObject.activeInHierarchy)
                    {
                        if (!GameManager.Player.IsDead())
                        {
                            ResetManager.Reset();
                        }
                    }

                    if (!GameManager.Player.IsDead())
                    {
                        Deactivate();
                    }
                }
            }
        }
예제 #3
0
 private void ResetScene()
 {
     ResetManager.Reset();
     player.Respawn();
     TargettingCamera.ClearTarget();
 }