示例#1
0
    /// <summary>
    /// Determine change in loc caused by keypresses this tic.
    /// </summary>
    /// <returns>Potential offset of cursor.</returns>
    private Loc determineOffset()
    {
        Loc offset = new Loc ();

        // Add to offset based on keyboard input
        // Must take perspective (rotation) of camera into consideration
        if (Input.GetButton ("Up"))
            offset = offset.plus (new Loc (0, 1, Cam.main.perspective));
        if (Input.GetButton ("Down"))
            offset = offset.plus (new Loc (0, -1, Cam.main.perspective));
        if (Input.GetButton ("Left"))
            offset = offset.plus (new Loc (-1, 0, Cam.main.perspective));
        if (Input.GetButton ("Right"))
            offset = offset.plus (new Loc (1, 0, Cam.main.perspective));

        return offset;
    }