Example #1
0
    //activate double jump function and show double jump tutorial
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            Time.timeScale = 0f;                //pause game
            doubleJumpTutorial.SetActive(true); //show tutorial screen
            playerController myPC = player.GetComponent <playerController>();
            myPC.canWallJump = true;
            tutorialController tutorial = player.GetComponent <tutorialController>();
            tutorial.doubleJumpTutorialActive = true;
            pauseMenu thePauseMenu = pauseMenuUI.GetComponent <pauseMenu>();
            thePauseMenu.enabled = false; //make it so the player can't pause during the tutorial since game is already paused
            Destroy(gameObject);

            myPC.audioRun.enabled    = false;
            myPC.audioSprint.enabled = false; //disable running and sprinting sounds in tutorial screen
        }
    }
Example #2
0
    //activate double jump function and show double jump tutorial
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            Time.timeScale = 0f;        //pause game
            chakraText.SetActive(true); //show tutorial screen
            playerController myPC = player.GetComponent <playerController>();
            myPC.chakraHalf = true;
            tutorialController tutorial = player.GetComponent <tutorialController>();
            tutorial.chakraTextActive = true;
            pauseMenu thePauseMenu = pauseMenuUI.GetComponent <pauseMenu>();
            thePauseMenu.enabled = false; //make it so the player can't pause during the tutorial since game is already paused
            Destroy(gameObject);

            myPC.audioRun.enabled    = false;
            myPC.audioSprint.enabled = false; //disable running and sprinting sounds in tutorial screen

            PlayerPrefs.SetString("ScrollObtained", "true");
        }
    }
Example #3
0
    //pickup kunai
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Player")
        {
            if (tutorialKunai) //show kunai tutorial screen when pick up tutorial kunai
            {
                kunaiPickup(collision);
                Time.timeScale = 0f;                 //pause game
                tutorialKunaiScreen.SetActive(true); //show tutorial screen
                tutorialController tutorial = player.GetComponent <tutorialController>();
                tutorial.kunaiTutorialActive = true;
                pauseMenu thePauseMenu = pauseMenuUI.GetComponent <pauseMenu>();
                thePauseMenu.enabled = false; //make it so the player can't pause during the tutorial since game is already paused

                playerController myPC = player.GetComponent <playerController>();
                myPC.audioRun.enabled    = false;
                myPC.audioSprint.enabled = false; //disable running and sprinting sounds in tutorial screen
            }
            else
            {
                kunaiPickup(collision); //if normal kunai then just pickup kunai
            }
        }
    }
Example #4
0
    void Update()
    {
        //jump when touching ground and space is pressed
        if (grounded && Input.GetAxis("Jump") > 0)
        {
            grounded = false;
            myAnim.SetBool("isGrounded", grounded);
            myRB.AddForce(new Vector2(0, jumpHeight));
            audioJump.Play();
        }

        //jump when touching wall and space is pressed when scroll obtained
        if (touchingWall && Input.GetAxis("Jump") > 0 && canWallJump == true)
        {
            touchingWall = false;
            myAnim.SetBool("isGrounded", grounded);
            if (myRB.velocity.y > 0)
            {
                myRB.AddForce(new Vector2(0, jumpHeight));
            }
            else
            {
                myRB.AddForce(new Vector2(0, jumpHeight * 2));
            }
            audioJump.Play();
        }

        //player melee
        if (Input.GetAxisRaw("Fire1") > 0)
        {
            meleeAttack();
        }

        //player shooting
        if (Input.GetAxisRaw("Fire2") > 0 && theAmmo.currentAmmo > 0)
        {
            throwKunai();
        }

        //player ultimate move
        if (!chakraHalf)
        {
            if (Input.GetKey(KeyCode.E) && theChakra.currentChakra == 100)
            {
                lightningAttack();
            }
        }
        else
        {
            if (Input.GetKey(KeyCode.E) && theChakra.currentChakra >= 50)
            {
                lightningAttack();
            }
        }

        //play jump throw animation when kunai is thrown in the air
        if (grounded == false && myAnim.GetBool("kunaiThrown") == true)
        {
            myAnim.Play("playerJumpThrow");
        }

        //play jump melee animation when left click is pressed mid air
        if (grounded == false && myAnim.GetBool("attackClick") == true)
        {
            myAnim.Play("playerJumpAttack");
        }

        //leave tutorials
        if (Input.GetKey(KeyCode.Escape))
        {
            tutorialController tutorialScreen = transform.GetComponent <tutorialController>();
            tutorialScreen.kunaiTutorial();
            tutorialScreen.doubleJumpTutorial();
            tutorialScreen.chakraTutorial();
            tutorialScreen.chakraPreservationScroll();
        }
    }