public override void StateUpdate()
 {
     mi            = pi.GetMovementInput();
     climbProgress = pi.playerScript.ClimbAlongLedge(startPosition, startTime, endPosition);
     //Default playerstate behavior to swap weapons in any state
     HandleWeaponSwapInput(pi);
 }
Esempio n. 2
0
    //This function controls the movement and ensures that it can't move the max distance from player.
    internal void movement()
    {
        if (Mathf.Abs(transform.position.x - player.transform.position.x) > maxDistanceFromPlayer)
        {
            float offset = 1f;
            if (transform.position.x < player.transform.position.x)
            {
                offset *= -1;
            }
            transform.position = new Vector3(transform.transform.position.x - offset, transform.position.y, transform.position.z);
        }
        else if (Mathf.Abs(transform.position.z - player.transform.position.z) > maxDistanceFromPlayer)
        {
            float offset = 1f;
            if (transform.position.z < player.transform.position.z)
            {
                offset *= -1;
            }
            transform.position = new Vector3(transform.position.x, transform.position.y, transform.transform.position.z - offset);
        }

        Vector2 m = inputScript.GetMovementInput();
        float   forwardMovement = 20f * Time.deltaTime;
        Vector3 movementVector  = new Vector3(m.x, 0f, m.y);

        transform.Translate(movementVector * forwardMovement, Space.World);
    }
Esempio n. 3
0
 public void StateUpdate()
 {
     mi = pi.GetMovementInput();
     //pass in the movement input vector so we know what direction to aim in
     pi.playerScript.SpellAim(mi.x, mi.y);
     spellInputTable = pi.GetSpellInputTable();
     ci = pi.GetCancelInput();
 }
Esempio n. 4
0
    //

    /*If the player is in this state, they will always do whatever is in state update.
     * Which includes accepting new input and */
    public override void StateUpdate()
    {
        pi.playerScript.Idle();
        mi = pi.GetMovementInput();
        ji = pi.GetJumpInput();
        ai = pi.GetAimInput();
        //Default playerstate behavior to swap weapons in any state
        HandleWeaponSwapInput(pi);
    }
Esempio n. 5
0
    //

    /*If the player is in this state, they will always do whatever is in state update.
     * Which includes accepting new input and */
    public void StateUpdate()
    {
        pi.playerScript.Idle();
        mi = pi.GetMovementInput();
        ri = pi.GetRunInput();
        ji = pi.GetJumpInput();
        spellInputTable = pi.GetSpellInputTable();
        cancelSpell     = pi.GetCancelInput();
    }
Esempio n. 6
0
 public void StateUpdate()
 {
     mi = pi.GetMovementInput();
     ri = pi.GetRunInput();
     spellInputTable = pi.GetSpellInputTable();
     ji = pi.GetJumpInput();
     pi.playerScript.GroundMovement(mi.x, mi.y, mi.magnitude);
     pi.playerScript.Run(ri.magnitude);
     cancelSpell = pi.GetCancelInput();
 }
 public override void StateUpdate()
 {
     mi        = pi.GetMovementInput();
     jumpInput = pi.GetJumpInput();
     //Only allow the player to jump if they stop pressing the jump input
     if (jumpInput == 0f)
     {
         canJump = true;
     }
     cancelClimb = pi.GetCancelClimbInput();
     //Default playerstate behavior to swap weapons in any state
     HandleWeaponSwapInput(pi);
 }
Esempio n. 8
0
 public override void StateUpdate()
 {
     mi        = pi.GetMovementInput();
     jumpInput = pi.GetJumpInput();
     pi.playerScript.GroundMovement(mi);
     pi.playerScript.GetPlayerRigidbody().velocity = new Vector3(0, fallingVelocity, 0);
     if (jumpInput == 0f)
     {
         superJumpReady = true;
     }
     //Default playerstate behavior to swap weapons in any state
     HandleWeaponSwapInput(pi);
 }
Esempio n. 9
0
    public override void StateUpdate()
    {
        fi  = pi.GetFireWeaponInput();
        mi  = pi.GetMovementInput();
        rsi = pi.GetRightStickInput();
        ji  = pi.GetJumpInput();
        ai  = pi.GetAimInput();

        if (fi > 0f)
        {
            pi.playerScript.FireCurrentWeapon();
        }
        else
        {
            pi.playerScript.StopFireWeapon();
        }

        pi.playerScript.Strafe(mi, rsi);
        //Default playerstate behavior to swap weapons in any state
        HandleWeaponSwapInput(pi);
    }
    public PlayerStateClimbing(PlayerInputScript player, GameObject go)
    {
        pi            = player;
        startPosition = pi.GetPlayerTransform().position;
        startTime     = Time.time;
        ledge         = go;

        //If this is the end of the ledge, and there's no ledge to jump onto, then don't climb
        if (startPosition == endPosition)
        {
            pi.currentState = new PlayerStateHangingOnLedge(pi, ledge);
        }

        mi = pi.GetMovementInput();
        if (mi.x >= 0.2f)
        {
            endPosition = ledge.GetComponent <LedgeScript>().GetRightMostPoint();
        }
        if (mi.x <= -0.2f)
        {
            endPosition = ledge.GetComponent <LedgeScript>().GetLeftMostPoint();
        }
        Debug.Log("entering climbing");
    }
Esempio n. 11
0
 public override void StateUpdate()
 {
     mi           = pi.GetMovementInput();
     jumpInput    = pi.GetJumpInput();
     jumpProgress = pi.playerScript.Jump(startPosition, startTime, mi);
 }
Esempio n. 12
0
 public void StateUpdate()
 {
     jumpTimer += Time.deltaTime;
     mi         = pi.GetMovementInput();
     pi.playerScript.Jump(walking, jumpTimer, mi);
 }