Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (replaying)
        {
            commProcess.Do();
        }
        //horizontal input for left and right
        //float move = Input.GetAxisRaw("Horizontal");

        //SendMessage("getPlayerPosition", transform.position);

        if (Keyboard.current.leftShiftKey.wasReleasedThisFrame) //this seems very messy to me, not sure where to put it
        {
            isSprinting = false;
        }


        if (Alive)
        {
            Move(currentInputDirection);
        }



        /*
         * RaycastHit2D hitInfo = Physics2D.Raycast(transform.position, Vector2.down, 1.0f, groundLayers.value);
         * if (hitInfo.collider != null)
         * {
         *  _grounded = true;
         * }
         */
        //if space key && grounded == true
        //current velocity = new velocity (current x, jumpforce)
        //grounded = false

        //2D raycast from player position downwards to ground
        //if hitInfo != null
        //grounded = true

        //current velocity = new velocity (horizontal input, current velocity.y);
        //_rigid.velocity = new Vector2(move*runSpeed, _rigid.velocity.y);
    }