Exemple #1
0
 private void FixedUpdate()
 {
     if (!Logic.Instance.IsGameOver && !Logic.Instance.StayPlayer)
     {
         IsGround = Physics2D.OverlapCircle(CoordinateLegs.position, 0.2f, Ground);
         Move();
         if (InputUI.GetKeyDown(UIKeyCode.FIRE))
         {
             UpSpeed(2);
         }
         if (IsGround)
         {
             JumpForce = basic_jump_force;                 // default jump when player on ground
         }
         if (IsUpSpeed && InputUI.GetKey(UIKeyCode.SPACE) && !IsGround)
         {
             UpJumpForceInAir();
         }
         if (InputUI.GetKeyDown(UIKeyCode.SPACE) && IsGround)
         {
             Jump(JumpForce);
         }
         if ((InputUI.GetKey(UIKeyCode.DOWN) || Input.GetKey(KeyCode.S)) && Logic.Instance.ModePlayer != Mode.LITTLE)
         {
             Sit();
         }
     }
 }
Exemple #2
0
 private void FixedUpdate()
 {
     if (InputUI.GetKeyDown(UIKeyCode.FIRE) && Logic.Instance.ModePlayer == Mode.FIRE && CountFireball < max_fireball)
     {
         Fire();
     }
     if (IsShoot)
     {
         shoot_timer += Time.deltaTime;
         if (shoot_timer >= shoot_time)
         {
             IsShoot     = false;
             shoot_timer = 0;
         }
     }
 }
Exemple #3
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Secret" && !isTeleport)
     {
         if (InputUI.GetKeyDown(UIKeyCode.DOWN))
         {
             isTeleport = true;
             direction  = Direction.DOWN;
             GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll;
             Logic.Instance.BackgroundMain.Stop();
             Logic.Instance.PipeAndDownLevel.Play();
             Invoke("TeleportToSecret", time_on_direction);
             Invoke("PlayBackgroundSecret", time_on_direction);
         }
     }
 }