Example #1
0
 void OnInputJump(InputManager.Info dat)
 {
     if (dat.state == InputManager.State.Pressed)
     {
         mCtrl.Jump(true);
     }
     else if (dat.state == InputManager.State.Released)
     {
         mCtrl.Jump(false);
     }
 }
Example #2
0
    void OnInputJump(InputManager.Info dat)
    {
        if (dat.state == InputManager.State.Pressed)
        {
            InputManager input = Main.instance.input;

            Weapon curWpn = currentWeapon;
            if (curWpn == null || curWpn.Jump(this) == false)
            {
                if (!mSliding)
                {
                    if (input.GetAxis(0, InputAction.MoveY) < -0.1f && mCtrl.isGrounded)
                    {
                        if (!curWpn.isFireActive || curWpn.allowSlide)
                        {
                            SetSlide(true);
                        }
                    }
                    else
                    {
                        mCtrl.Jump(true);
                        if (mCtrl.isJumpWall)
                        {
                            Vector2 p = mCtrlSpr.wallStickParticle.transform.position;
                            PoolController.Spawn("fxp", "wallSpark", "wallSpark", null, p);
                            sfxWallJump.Play();
                        }
                    }
                }
                else
                {
                    if (input.GetAxis(0, InputAction.MoveY) >= 0.0f)
                    {
                        //if we can stop sliding, then jump
                        SetSlide(false, false);
                        if (!mSliding)
                        {
                            mCtrl.Jump(true);
                        }
                    }
                }
            }
        }
        else if (dat.state == InputManager.State.Released)
        {
            mCtrl.Jump(false);
        }
    }
Example #3
0
    public void Jump(float delay)
    {
        if (mBodyCtrl)
        {
            CancelInvoke(JumpFinishKey);

            if (delay > 0)
            {
                mBodyCtrl.Jump(true);
                Invoke(JumpFinishKey, delay);
            }
            else
            {
                mBodyCtrl.Jump(false);
            }
        }
    }
    protected override void StateChanged()
    {
        switch ((State)prevState)
        {
        case State.Active:
            mCtrl.Jump(false);
            mCtrl.moveSide = 0.0f;
            break;
        }

        base.StateChanged();

        switch ((State)state)
        {
        case State.Active:
            //mCtrl.gravityController.enabled = true;
            //mCtrl.enabled = true;
            mCtrl.moveSideLock = true;
            mCtrl.moveEnabled  = true;
            mCtrl.ResetCollision();
            dieDelay = mDefaultDieDelay;
            mLastFollowPlayerTime = 0;
            mLastJumpTime         = Time.fixedTime;
            break;

        case State.Dying:
            shaker.enabled = true;
            mCtrl.moveSide = 0.0f;
            mCtrl.ResetCollision();
            Vector3 lv = mCtrl.localVelocity;
            lv.x = 0.0f;
            mCtrl.localVelocity = lv;
            break;

        case State.Invalid:
            //mCtrl.gravityController.enabled = false;
            //mCtrl.enabled = false;
            shaker.enabled = false;
            break;
        }
    }
Example #5
0
    void OnInputJump(InputManager.Info dat)
    {
        if (dat.state == InputManager.State.Pressed)
        {
            if (!mSliding)
            {
                InputManager input = Main.instance.input;

                if (input.GetAxis(0, InputAction.MoveY) < -0.1f && mCtrl.isGrounded)
                {
                    Weapon curWpn = weapons[mCurWeaponInd];
                    if (!curWpn.isFireActive || curWpn.allowSlide)
                    {
                        SetSlide(true);
                    }
                }
                else
                {
                    mCtrl.Jump(true);
                }
            }
            else
            {
                //if we can stop sliding, then jump
                SetSlide(false, false);
                if (!mSliding)
                {
                    mCtrl.Jump(true);
                }
            }
        }
        else if (dat.state == InputManager.State.Released)
        {
            mCtrl.Jump(false);
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("Jump"))
     {
         pc.Jump();
     }
     if (Input.GetAxis("Horizontal") > 0)
     {
         pc.Move(Vector2.right);
     }
     if (Input.GetAxis("Horizontal") < 0)
     {
         pc.Move(Vector2.left);
     }
 }