Beispiel #1
0
    IEnumerator useBellows()
    {
        if (bellows_active)
        {
            SpriteRenderer sr = bellows.GetComponent <SpriteRenderer> ();
            anim.SetBool("bellowActive", false);

            //we use the opposite of how we calculated the angle because we want to blow in the opposite direction
            pphysics.zeroVelocity();
            pphysics.ApplyForce(bellows.transform.rotation * Vector3.left * 300);

            bellows_active = false;
            Sprite sprite = Resources.Load <Sprite> ("Sprites/bellows_compressed_with_air");
            sr.sprite = sprite;

            if (pphysics.collidingWithLetter)
            {
                resetItemAvailability(3);
                resetJumpCount();
            }
            else if (jumpCount == 0)
            {
                jumpCount = 1;
            }

            pphysics.InSlowMotion = false;

            yield return(new WaitForSeconds(0.2f));

            playerHasControl = true;
            sr.sprite        = Resources.Load <Sprite> ("Sprites/bellows");
            bellows.SetActive(false);
        }
        yield return(null);
    }
Beispiel #2
0
 public void CheckMove()
 {
     if (Mathf.Abs(mPlayerInput.mRawMove.x) > mPlayerInput.mTriggerDeadZone)
     {
         if (!mPlayerAttack.isInHitstun)
         {
             if (mPlayerPhysics.mGrounded)
             {
                 mPlayerPhysics.ApplyForce(new Vector2(mMovementAcceleration * mPlayerInput.mRawMove.x, 0));
             }
             else
             {
                 mPlayerPhysics.ApplyForce(new Vector2(mMovementAcceleration * .1f * mPlayerInput.mRawMove.x, 0));
             }
         }
     }
 }
Beispiel #3
0
    IEnumerator UseSpring(Collision2D other)
    {
        springInUse = true;
        PlayerPhysics pp = other.gameObject.GetComponent <PlayerPhysics> ();

        other.rigidbody.velocity = new Vector2(other.rigidbody.velocity.x, 0);
        pp.ApplyForce(Vector3.up * 600);

        sr.sprite = sprites [1];
        yield return(new WaitForSeconds(0.1f));

        sr.sprite = sprites [2];
        yield return(new WaitForSeconds(0.1f));

        sr.sprite = sprites [0];

        springInUse = false;
        yield return(null);
    }