Exemple #1
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.W) && jumpEnable)
        {
            GetComponent <Rigidbody2D>().AddForce(baseJumpHeight * motorCortexContainer.GetWorkerCount(), ForceMode2D.Impulse);
        }

        if (Input.GetKey(KeyCode.W))
        {
            animator.SetInteger("PlayerWalking", 0);
        }
        animator.SetInteger("PlayerAttacking", 0);
        if (Input.GetKey(KeyCode.A))
        {
            animator.SetInteger("PlayerWalking", 1);
        }
        animator.SetInteger("PlayerAttacking", 0);
        if (Input.GetKey(KeyCode.D))
        {
            animator.SetInteger("PlayerWalking", 1);
        }
        animator.SetInteger("PlayerAttacking", 0);
        if (Input.GetKey(KeyCode.Space))
        {
            animator.SetInteger("PlayerAttacking", 1);
        }
        animator.SetInteger("PlayerWalking", 0);
    }
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.W) && jumpEnable)
     {
         GetComponent <Rigidbody2D>().AddForce(baseJumpHeight * motorCortexContainer.GetWorkerCount(), ForceMode2D.Impulse);
     }
 }