예제 #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Danger")
     {
         Destroy(gameObject);
         PlayerUtility.setAttemptText(txt, AttemptsTracker.incrementAndGetAttemptLevelTwo());
         SceneManager.LoadScene(3);
     }
 }
예제 #2
0
    void Update()
    {
        if (onGround)
        {
            PlayerUtility.PlayerAction(body2D, RUNNING_VELOCITY, NO_VELOCITY);
            PlayerUtility.ChangeAnimation(animator, RUNNING_ANIMATION);
        }

        if (PlayerUtility.CanJump(onGround, Input.GetKey(SPACE)))
        {
            PlayerUtility.PlayerAction(body2D, RUNNING_VELOCITY, JUMPING_VELOCITY);
            body2D.AddForce((Vector2.right * RUNNING_VELOCITY) * THRUST);
        }

        if (player.transform.position.x >= FINISH_LOCATION_X_AXIS)
        {
            PlayerUtility.PlayerAction(body2D, NO_VELOCITY, NO_VELOCITY);
            PlayerUtility.ChangeAnimation(animator, IDLE_ANIMATION);
            txt.text = LEVEL_COMPLETE_MESSAGE;
            AttemptsTracker.setAttemptLevelTwoToZero();
        }
    }
예제 #3
0
 void Start()
 {
     PlayerUtility.setAttemptText(txt, AttemptsTracker.getAttemptLevelTwo());
 }