示例#1
0
        private void FixedUpdate()
        {
            if (!GameManager.isRunning)
            {
                return;
            }

            PlayerJump.CheckGround();
            Move();
        }
示例#2
0
        private void Move()
        {
            float speed = (state == Status.Running) ? runningSpeed : moveSpeed;

            rb.velocity = new Vector2(speedDir * speed, rb.velocity.y);

            if (canJump && wantsToJump)
            {
                PlayerJump.Jump();
            }

            PlayerAnimation.ChangeSprite();
        }
示例#3
0
        private void LoadComponents()
        {
            _playerAnimator = GetComponent <PlayerAnimator>();
            Debug.Assert(null != _playerAnimator, $"PlayerAnimator component missing on {name}.");

            _movement = GetComponent <PlayerMovement>();
            Debug.Assert(null != _movement, $"PlayerMovement component missing on {name}.");

            _jump = GetComponent <PlayerJump>();
            Debug.Assert(null != _jump, $"PlayerJump component not present on {name}.");

            _attack = GetComponent <PlayerAttack>();
            Debug.Assert(null != _attack, $"PlayerAttack component not present on {name}.");
        }
示例#4
0
        private IEnumerator SmoothDeath()
        {
            if (PlayerController.instance.rb.position.y < GameManager.deathPlaneY)
            {
                PlayerController.instance.rb.position = new Vector2(PlayerController.instance.rb.position.x, GameManager.deathPlaneY);
            }

            PlayerController.instance.rb.velocity = new Vector2(0, PlayerController.instance.rb.velocity.y);

            PlayerJump.Jump(PlayerManager.instance.Character.deathJumpSpeed);

            while (PlayerController.instance.rb.position.y >= GameManager.deathPlaneY)
            {
                yield return(null);
            }

            PlayerManager.ReSpawn();
        }
示例#5
0
        public void KillJump()
        {
            float jSpeed = Input.GetKey(KeyCode.Space) ? PlayerManager.instance.Character.jumpSpeed : PlayerManager.instance.Character.enemtKillJumpSpeed;

            PlayerJump.Jump(jSpeed);
        }