public void SwitchLanes(Utils.Movement direction) { float newX = targetX + Utils.DIRECTION_OFFSETS[(int)direction]; //If moving would exceed bounds if (newX > Utils.PLAYER_MAX_X_POSITION || newX < Utils.PLAYER_MIN_X_POSITION) { return; } targetX = newX; Player.S.PA.InitiateSwitch(targetX, direction); //transform.position = pos; }
public void InitiateSwitch(float target_in, Utils.Movement direction_in) { m_switching = true; m_target = target_in; m_direction = direction_in; }