示例#1
0
    void Movement()
    {
        //Movement
        Vector3 temp = transform.position;

        //  If there is anything limiting the player's horizontal movement
        //		(i.e. being on a ladder)
        //  lock their horizontal controls
        if (Input.GetKey("a"))
        {
            temp.x -= moveSpeed * Time.deltaTime;
        }
        else if (Input.GetKey("d"))
        {
            temp.x += moveSpeed * Time.deltaTime;
        }


        if (Input.GetKey("w"))
        {
            ladMove = LAD_MOVEMENT.UP;
        }
        else if (Input.GetKey("s"))
        {
            ladMove = LAD_MOVEMENT.DOWN;
        }

        else
        {
            ladMove = LAD_MOVEMENT.STAY;
        }


        transform.position = temp;
    }
    void Movement()
    {
        //Movement
        Vector3 temp = transform.position;

        //  If there is anything limiting the player's horizontal movement
        //		(i.e. being on a ladder)
        //  lock their horizontal controls
        if (Input.GetKey ("a"))
            temp.x -= moveSpeed * Time.deltaTime;
        else if (Input.GetKey ("d"))
            temp.x += moveSpeed * Time.deltaTime;

        if (Input.GetKey("w"))
            ladMove = LAD_MOVEMENT.UP;
        else if (Input.GetKey("s"))
            ladMove = LAD_MOVEMENT.DOWN;

        else ladMove = LAD_MOVEMENT.STAY;

        transform.position = temp;
    }
    void Movement()
    {
        if (stunDurration > 0.0f) {
            stunDurration -= Time.deltaTime;

            return;
        }
        //Movement
        Vector3 temp = transform.position;

        //  If there is anything limiting the player's horizontal movement
        //		(i.e. being on a ladder)
        //  lock their horizontal controls
        if (Input.GetKey ("a")) {
            temp.x -= moveSpeed * Time.fixedDeltaTime;

            facingRight = false;
            Flip (facingRight);
            moving = true;
        } else if (Input.GetKey ("d")) {
            temp.x += moveSpeed * Time.fixedDeltaTime;

            facingRight = true;
            Flip (facingRight);
            moving = true;
        } else
            moving = false;

        if (Input.GetKey("w"))
            ladMove = LAD_MOVEMENT.UP;
        else if (Input.GetKey("s"))
            ladMove = LAD_MOVEMENT.DOWN;

        else ladMove = LAD_MOVEMENT.STAY;

        transform.position = temp;
    }