// Update is called once per frame
 void Update()
 {
     animator.ResetTrigger("shoot");
     if (isGrounded != groundChecker.isGrounded())
     {
         if (!isGrounded)
         {
             animator.SetBool("landed", true);
         }
         isGrounded = groundChecker.isGrounded();
         animator.SetBool("isGrounded", isGrounded);
     }
     else
     {
         animator.SetBool("landed", false);
     }
     if (Input.GetButton("Fire1") && Time.time > nextFire)
     {
         nextFire = Time.time + fireRate;
         animator.SetTrigger("shoot");
     }
     if (Input.GetAxis("Horizontal") != 0.0f || Input.GetAxis("Vertical") != 0.0f)
     {
         animator.SetFloat("move", 10f);
     }
     else
     {
         animator.SetFloat("move", 0.0f);
     }
 }
예제 #2
0
파일: PlayerAnim.cs 프로젝트: MeesMD/Mythe
    void Update()
    {
        //Jump
        if (groundChecker.isGrounded())
        {
            anim.SetBool("isJumping", false);
        }
        else if (!groundChecker.isGrounded())
        {
            anim.SetBool("isJumping", true);
        }


        //Walk
        if (inputManager.Right())
        {
            anim.SetBool("Walk", true);

            //Verander waarde van Vector2 voor grote speler!
            transform.localScale = new Vector2(0.7f, 0.7f);
        }

        else if (inputManager.Left())
        {
            anim.SetBool("Walk", true);

            //Verander waarde van Vector2 voor grote speler!
            transform.localScale = new Vector2(-0.7f, 0.7f);
        }

        else
        {
            anim.SetBool("Walk", false);
        }
    }
예제 #3
0
파일: PlayerJump.cs 프로젝트: MeesMD/Mythe
    void Update()
    {
        groundChecker.isGrounded();

        if (inputManager.Up() && groundChecker.isGrounded())
        {
            if (inputManager.Up())
            {
                _rb.velocity = Vector2.up * _jumpVel;
            }
        }

        if (_rb.velocity.y < 0)
        {
            _rb.velocity += Vector2.up * Physics2D.gravity.y * _gravity * Time.deltaTime;
        }
    }
예제 #4
0
 private void applyGravity()
 {
     isGrounded = groundChecker.isGrounded();
     if (isGrounded && verticalVelocity < 0)
     {
         verticalVelocity = -2f;
     }
     else
     {
         verticalVelocity += gravity * Time.deltaTime;
     }
     characterController.Move(Utils.normalizeDirection(transform.up) * verticalVelocity * Time.deltaTime);
 }
예제 #5
0
 private void input()
 {
     if (!groundChecker.isGrounded())
     {
         if (Input.GetKeyDown(KeyCode.Q))
         {
             enableRotation(RotationDirection.LeftDirection);
         }
         if (Input.GetKeyDown(KeyCode.E))
         {
             enableRotation(RotationDirection.RightDirection);
         }
     }
 }
예제 #6
0
 // Update is called once per frame
 void Update()
 {
     if ((Input.GetAxis("Horizontal") != 0.0f || Input.GetAxis("Vertical") != 0.0f) && !audio.isPlaying && groundChecker.isGrounded() && Time.timeScale == 1)
     {
         audio.Play();
     }
     else if (audio.isPlaying)
     {
         audio.Pause();
     }
 }